Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASSANDRA-20497 Update generate-eclipse-files to work for JDK 11 #4020

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

tolbertam
Copy link
Contributor

@tolbertam tolbertam commented Mar 30, 2025

As JDK 8 is no longer supported, generate-eclipse-files no longer works.

Updates the build to work with JDK 11 and updates several source files with trivial changes to avoid confusing the eclipse compiler.

Patch by Andy Tolbert for CASSANDRA-20497


Note: Just about everything seems functional, except when running any code, one must add -Djdk.attach.allowAttachSelf=true; There doesn't seem to be an easy way to override this for run configurations at a project level, but I see that the IDE documentation on the website references adding some runtime arguments already, so I can always follow up and update that after this is merged.

@@ -435,7 +435,7 @@ private void guardCollectionSize(DecoratedKey partitionKey, Row row)
}
}

protected static abstract class AbstractIndexWriter extends AbstractTransactional implements Transactional
public static abstract class AbstractIndexWriter extends AbstractTransactional implements Transactional
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this is necessary with ecj. Given its the only compiler problem in the base source, felt worth making this minimal change which is very unlikely to cause any problems

ERROR [MemtablePostFlush:1] 2025-03-30 12:32:17,991 JVMStabilityInspector.java:70 - Exception in thread Thread[MemtablePostFlush:1,5,MemtablePostFlush]
java.lang.Error: Unresolved compilation problem: 
	The type SortedTableWriter.AbstractIndexWriter is not visible

	at org.apache.cassandra.io.sstable.format.big.BigTableWriter$IndexWriter.<init>(BigTableWriter.java:237)
	at org.apache.cassandra.io.sstable.format.big.BigTableWriter$Builder.openIndexWriter(BigTableWriter.java:405)
	at org.apache.cassandra.io.sstable.format.big.BigTableWriter$Builder.openIndexWriter(BigTableWriter.java:1)
	at org.apache.cassandra.io.sstable.format.SortedTableWriter.<init>(SortedTableWriter.java:105)
	at org.apache.cassandra.io.sstable.format.big.BigTableWriter.<init>(BigTableWriter.java:79)
	at org.apache.cassandra.io.sstable.format.big.BigTableWriter$Builder.buildInternal(BigTableWriter.java:441)
	at org.apache.cassandra.io.sstable.format.big.BigTableWriter$Builder.buildInternal(BigTableWriter.java:1)
	at org.apache.cassandra.io.sstable.format.SSTableWriter$Builder.build(SSTableWriter.java:566)
	at org.apache.cassandra.io.sstable.SimpleSSTableMultiWriter.create(SimpleSSTableMultiWriter.java:135)
	at org.apache.cassandra.db.compaction.AbstractCompactionStrategy.createSSTableMultiWriter(AbstractCompactionStrategy.java:567)
	at org.apache.cassandra.db.compaction.CompactionStrategyHolder.createSSTableMultiWriter(CompactionStrategyHolder.java:249)
	at org.apache.cassandra.db.compaction.CompactionStrategyManager.createSSTableMultiWriter(CompactionStrategyManager.java:1267)
	at org.apache.cassandra.db.ColumnFamilyStore.createSSTableMultiWriter(ColumnFamilyStore.java:665)
	at org.apache.cassandra.db.ColumnFamilyStore.createSSTableMultiWriter(ColumnFamilyStore.java:660)
	at org.apache.cassandra.db.memtable.Flushing.createFlushWriter(Flushing.java:209)
	at org.apache.cassandra.db.memtable.Flushing.flushRunnable(Flushing.java:113)
	at org.apache.cassandra.db.memtable.Flushing.flushRunnables(Flushing.java:72)
	at org.apache.cassandra.db.ColumnFamilyStore$Flush.flushMemtable(ColumnFamilyStore.java:1296)
	at org.apache.cassandra.db.ColumnFamilyStore$Flush.run(ColumnFamilyStore.java:1251)
	at org.apache.cassandra.concurrent.ExecutionFailure$1.run(ExecutionFailure.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:829)

@@ -2037,6 +2043,12 @@
</classpath>
</taskdef>
<mkdir dir=".settings" />
<echo file=".settings/org.eclipse.jdt.core.prefs"><![CDATA[eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage=enabled
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed to get around high-scale-lib possessing java.util and java.util.concurrent packages.

@@ -2037,6 +2043,12 @@
</classpath>
</taskdef>
<mkdir dir=".settings" />
<echo file=".settings/org.eclipse.jdt.core.prefs"><![CDATA[eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coerces code to be compiled targeting java 11 (if default configured JVM is newer)

@@ -1998,7 +1998,7 @@
</path>
<pathconvert property="eclipse-libs-list" refid="eclipse-project-libs-path" pathsep="${line.separator}">
<mapper>
<regexpmapper from="^(.*)$$" to='&lt;classpathentry kind="lib" path="\1\" \/&gt;'/>
<regexpmapper from="^(.*)$$" to=' &lt;classpathentry kind="lib" path="\1" /&gt;'/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generates invalid xml in the .classpath file otherwise.

@@ -469,13 +469,6 @@ private static IntHashSet asSet(int[] array)
return set;
}

public interface Schema
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As is HarryTopologyMixupTest fails to build with:

Schema cannot be resolved to a type

@tolbertam tolbertam changed the title Update generate-eclipse-files to work for JDK 11 CASSANDRA-20497: Update generate-eclipse-files to work for JDK 11 Mar 30, 2025
@tolbertam tolbertam changed the title CASSANDRA-20497: Update generate-eclipse-files to work for JDK 11 CASSANDRA-20497 Update generate-eclipse-files to work for JDK 11 Mar 30, 2025
@tolbertam
Copy link
Contributor Author

will clean this up a bit in another PR (also just recreating so the github bot updates the JIRA since I didn't originally have the ticket number in my commit)

@tolbertam tolbertam closed this Mar 30, 2025
@tolbertam
Copy link
Contributor Author

hah, guess I had to do something to provoke the bot to work, reopening.

@tolbertam tolbertam reopened this Mar 30, 2025
As JDK 8 is no longer supported, generate-eclipse-files no longer works.

Updates the build to work with JDK 11.  There are still some issues
in dtest code specifically that confuses eclipse, but this will allow
basic eclipse functionality where it is currently broken.
* Move Schema from TopologyMixupTestBase to its own file.
* Remove ambiguity in LongBTreeTest#testRandomSelection between
  functions that accept BTreeTestFactory and Consumer
@tolbertam
Copy link
Contributor Author

rebased on trunk with no changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant