Skip to content

Commit 011a487

Browse files
committed
Merge remote-tracking branch 'origin/BETA_JAVA24'
2 parents ddece14 + 6f26e8a commit 011a487

File tree

12 files changed

+82
-19
lines changed

12 files changed

+82
-19
lines changed

org.eclipse.jdt.astview/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.jdt.astview
33
Bundle-ManifestVersion: 2
44
Bundle-Name: %pluginName
55
Bundle-SymbolicName: org.eclipse.jdt.astview; singleton:=true
6-
Bundle-Version: 1.7.0.qualifier
6+
Bundle-Version: 1.7.100.qualifier
77
Bundle-Activator: org.eclipse.jdt.astview.ASTViewPlugin
88
Bundle-Vendor: %providerName
99
Bundle-Localization: plugin

org.eclipse.jdt.astview/src/org/eclipse/jdt/astview/views/ASTView.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132

133133
import org.eclipse.jdt.ui.JavaUI;
134134

135-
136135
public class ASTView extends ViewPart implements IShowInSource, IShowInTargetList {
137136

138137
private class ASTViewSelectionProvider implements ISelectionProvider {

org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/text/AbstractFastJavaPartitionScanner.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,6 @@ public IToken nextToken() {
353353
case '\r':
354354
case '\n':
355355
return postFix(MARKDOWN_COMMENT);
356-
case '/':
357-
fTokenLength++;
358-
fLast= SLASH_SLASH_SLASH;
359-
break;
360356
default:
361357
consume();
362358
break;

org.eclipse.jdt.core.manipulation/common/org/eclipse/jdt/internal/ui/util/ASTHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019, 2024 IBM Corporation and others.
2+
* Copyright (c) 2019, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -39,6 +39,7 @@ public class ASTHelper {
3939
public static final int JLS21 = AST.JLS21;
4040
public static final int JLS22 = AST.JLS22;
4141
public static final int JLS23 = AST.JLS23;
42+
public static final int JLS24 = AST.JLS24;
4243

4344
private static boolean isNodeTypeSupportedInAST(AST ast, int nodeType) {
4445
switch (nodeType) {

org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/corext/util/JavaModelUtil.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public final class JavaModelUtil {
7676
*/
7777
public static final String VERSION_LATEST;
7878
static {
79-
VERSION_LATEST= JavaCore.VERSION_23; // make sure it is not inlined
79+
VERSION_LATEST= JavaCore.VERSION_24; // make sure it is not inlined
8080
}
8181

8282
public static final int VALIDATE_EDIT_CHANGED_CONTENT= 10003;
@@ -847,6 +847,10 @@ public static boolean is23OrHigher(String compliance) {
847847
return !isVersionLessThan(compliance, JavaCore.VERSION_23);
848848
}
849849

850+
public static boolean is24OrHigher(String compliance) {
851+
return !isVersionLessThan(compliance, JavaCore.VERSION_24);
852+
}
853+
850854
/**
851855
* Checks if the given project or workspace has source compliance 9 or greater.
852856
*
@@ -1002,6 +1006,17 @@ public static boolean is23OrHigher(IJavaProject project) {
10021006
return is23OrHigher(getSourceCompliance(project));
10031007
}
10041008

1009+
/**
1010+
* Checks if the given project or workspace has source compliance 24 or greater.
1011+
*
1012+
* @param project the project to test or <code>null</code> to test the workspace settings
1013+
* @return <code>true</code> if the given project or workspace has source compliance 24 or
1014+
* greater.
1015+
*/
1016+
public static boolean is24OrHigher(IJavaProject project) {
1017+
return is24OrHigher(getSourceCompliance(project));
1018+
}
1019+
10051020
public static String getSourceCompliance(IJavaProject project) {
10061021
return project != null ? project.getOption(JavaCore.COMPILER_SOURCE, true) : JavaCore.getOption(JavaCore.COMPILER_SOURCE);
10071022
}
@@ -1027,6 +1042,8 @@ public static String getCompilerCompliance(IVMInstall2 vMInstall, String default
10271042
String version= vMInstall.getJavaVersion();
10281043
if (version == null) {
10291044
return defaultCompliance;
1045+
} else if (version.startsWith(JavaCore.VERSION_24)) {
1046+
return JavaCore.VERSION_24;
10301047
} else if (version.startsWith(JavaCore.VERSION_23)) {
10311048
return JavaCore.VERSION_23;
10321049
} else if (version.startsWith(JavaCore.VERSION_22)) {
@@ -1077,7 +1094,9 @@ public static String getExecutionEnvironmentCompliance(IExecutionEnvironment exe
10771094

10781095
// fallback:
10791096
String desc= executionEnvironment.getId();
1080-
if (desc.indexOf(JavaCore.VERSION_23) != -1) {
1097+
if (desc.indexOf(JavaCore.VERSION_24) != -1) {
1098+
return JavaCore.VERSION_24;
1099+
} else if (desc.indexOf(JavaCore.VERSION_23) != -1) {
10811100
return JavaCore.VERSION_23;
10821101
} else if (desc.indexOf(JavaCore.VERSION_22) != -1) {
10831102
return JavaCore.VERSION_22;

org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/Java23SemanticHighlightingTest.java renamed to org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/Java24SemanticHighlightingTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222
import org.eclipse.jdt.internal.ui.javaeditor.SemanticHighlightingsCore;
2323

24-
public class Java23SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
24+
public class Java24SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
2525

2626
@Rule
27-
public SemanticHighlightingTestSetup shts= new SemanticHighlightingTestSetup( "/SHTest/src/Java23.java");
27+
public SemanticHighlightingTestSetup shts= new SemanticHighlightingTestSetup( "/SHTest/src/Java24.java");
2828

2929
@Before
3030
public void updateCompliance() {
31-
shts.updateCompliance("23", true);
31+
shts.updateCompliance("24", true);
3232
}
3333

3434
@Test

org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/JdtTextTestSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
SemanticHighlightingTest.class,
5757
SemanticTokensProviderTest.class,
5858
AutoboxingSemanticHighlightingTest.class,
59-
Java23SemanticHighlightingTest.class,
59+
Java24SemanticHighlightingTest.class,
6060
NewForLoopJavaContextTest.class,
6161
IteratorForLoopJavaContextTest.class,
6262
ArrayWithTempVarForLoopJavaContextTest.class,

org.eclipse.jdt.text.tests/testResources/semanticHighlightingTest1/Java23.java renamed to org.eclipse.jdt.text.tests/testResources/semanticHighlightingTest1/Java24.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import module java.base;
22

3-
public class Java23 {
3+
public class Java24 {
44
sealed record SampleRecord(String left, String right) {
55

66
}

org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/hover/MarkdownCommentTests.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,4 +983,44 @@ void foo() {}
983983
""";
984984
assertHtmlContent(expectedContent, actualHtmlContent);
985985
}
986+
987+
@Test
988+
public void testArrayReferenceInCode() throws CoreException {
989+
String source= """
990+
/// In the following indented code block, `[i]` is program text,
991+
/// and not a hyper link:
992+
///
993+
/// int i = 3;
994+
/// int[] d = new int[i];
995+
///
996+
/// Likewise, in the following fenced code block, `[i]` is program text,
997+
/// and not a hyper link:
998+
///
999+
/// ```
1000+
/// int i = 3;
1001+
/// int[] d = new int[i];
1002+
/// ```
1003+
public class ArrayInCode {
1004+
}
1005+
""";
1006+
ICompilationUnit cu= getWorkingCopy("/TestSetupProject/src/p/ArrayInCode.java", source, null);
1007+
assertNotNull("ArrayInCode.java", cu);
1008+
1009+
String expectedContent= """
1010+
<p>In the following indented code block, <code>[i]</code> is program text,
1011+
and not a hyper link:</p>
1012+
<pre><code>int i = 3;
1013+
int[] d = new int[i];
1014+
</code></pre>
1015+
<p>Likewise, in the following fenced code block, <code>[i]</code> is program text,
1016+
and not a hyper link:</p>
1017+
<pre><code>int i = 3;
1018+
int[] d = new int[i];
1019+
</code></pre>
1020+
""";
1021+
IType type= cu.getType("ArrayInCode");
1022+
String actualHtmlContent= getHoverHtmlContent(cu, type);
1023+
assertHtmlContent(expectedContent, actualHtmlContent);
1024+
}
1025+
9861026
}

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/infoviews/JavadocView.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ protected boolean isIgnoringNewInput(IJavaElement je, IWorkbenchPart part, ISele
11591159
try {
11601160
int offset= textSel.getOffset();
11611161
String partition= ((IDocumentExtension3)document).getContentType(IJavaPartitions.JAVA_PARTITIONING, offset, false);
1162-
return !IJavaPartitions.JAVA_DOC.equals(partition);
1162+
return !IJavaPartitions.JAVA_DOC.equals(partition) && !IJavaPartitions.JAVA_MARKDOWN_COMMENT.equals(partition);
11631163
} catch (BadPartitioningException | BadLocationException ex) {
11641164
return false;
11651165
}
@@ -1199,7 +1199,8 @@ protected IJavaElement findSelectedJavaElement(IWorkbenchPart part, ISelection s
11991199

12001200
if (document != null) {
12011201
ITypedRegion typedRegion= TextUtilities.getPartition(document, IJavaPartitions.JAVA_PARTITIONING, textSelection.getOffset(), false);
1202-
if (IJavaPartitions.JAVA_DOC.equals(typedRegion.getType())){
1202+
if (IJavaPartitions.JAVA_DOC.equals(typedRegion.getType())
1203+
|| IJavaPartitions.JAVA_MARKDOWN_COMMENT.equals(typedRegion.getType())){
12031204
element= TextSelectionConverter.getElementAtOffset((JavaEditor) part, textSelection);
12041205
}
12051206
else if (editorInput instanceof IFileEditorInput fei) {

0 commit comments

Comments
 (0)