Skip to content

Commit

Permalink
Merge pull request #3034 from jarthana/BETA_JAVA24
Browse files Browse the repository at this point in the history
Merge master into BETA_JAVA24
  • Loading branch information
jarthana authored Sep 30, 2024
2 parents 50473b1 + 85b01a4 commit c0b884e
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 108 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/checkMergeCommits.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Fast running checks for pull-requests

name: Pull-Request Checks
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request

jobs:
check-freeze-period:
if: github.base_ref == 'master'
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/verifyFreezePeriod.yml@master
check-merge-commits:
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/checkMergeCommits.yml@master
check-versions:
if: github.base_ref == 'master'
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/checkVersions.yml@master
with:
botName: Eclipse JDT Bot
botMail: [email protected]
12 changes: 0 additions & 12 deletions .github/workflows/verifyFreezePeriod.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/version-increments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Publish Version Check Results

on:
workflow_run:
workflows: [ 'Pull-Request Checks' ]
types: [ completed ]

jobs:
publish-version-check-results:
uses: eclipse-platform/eclipse.platform.releng.aggregator/.github/workflows/publishVersionCheckResults.yml@master
with:
botGithubId: eclipse-jdt-bot
secrets:
githubBotPAT: ${{ secrets.JDT_BOT_PAT }}
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pipeline {
}
tools {
maven 'apache-maven-latest'
jdk 'openjdk-jdk21-latest'
jdk 'openjdk-jdk23-latest'
}
stages {
stage('Build') {
Expand Down
4 changes: 4 additions & 0 deletions org.eclipse.jdt.annotation_v1/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ bin.includes = META-INF/,\
src/,\
about.html
src.includes = about.html

# Disable all baseline and API checks for this older version of org.eclipse.jdt.annotation
pom.model.property.skipAPIAnalysis = true
pom.model.property.version.baseline.check.skip = true
49 changes: 0 additions & 49 deletions org.eclipse.jdt.annotation_v1/pom.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,15 @@ protected boolean commentParse() {
int lastStarPosition = -1;

// Init scanner position
this.markdown = this.source[this.javadocStart + 1] == '/';
this.linePtr = getLineNumber(this.firstTagPosition);
int realStart = this.linePtr==1 ? this.javadocStart : this.scanner.getLineEnd(this.linePtr-1)+1;
if (realStart < this.javadocStart) realStart = this.javadocStart;
int realStart = this.javadocStart;
if (!this.markdown) {
realStart = this.linePtr==1 ? this.javadocStart : this.scanner.getLineEnd(this.linePtr-1)+1;
if (realStart < this.javadocStart) realStart = this.javadocStart;
} else {
this.linePtr = getLineNumber(realStart);
}
this.scanner.resetTo(realStart, this.javadocEnd);
this.index = realStart;
if (realStart == this.javadocStart) {
Expand All @@ -191,7 +197,6 @@ protected boolean commentParse() {
}
int previousPosition = this.index;
char nextCharacter = 0;
this.markdown = this.source[this.javadocStart + 1] == '/';
this.markdownHelper = IMarkdownCommentHelper.create(this);
if (realStart == this.javadocStart) {
nextCharacter = readChar(); // second '*' or '/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ public void recordFenceChar(char previous, char next, boolean lineStarted) {
int required = this.insideFencedCodeBlock ? this.fenceLength : 3;
if (++this.fenceCharCount == required) {
this.insideFencedCodeBlock^=true;
this.fenceLength = this.fenceCharCount;
}
if (this.insideFencedCodeBlock && this.fenceCharCount >= this.fenceLength)
this.fenceLength = this.fenceCharCount;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected Map getCompilerOptions() {
options.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
options.put(CompilerOptions.OPTION_DocCommentSupport, this.docCommentSupport);
options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, this.reportInvalidJavadoc);
options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
if (!CompilerOptions.IGNORE.equals(this.reportInvalidJavadoc)) {
options.put(CompilerOptions.OPTION_ReportInvalidJavadocTagsVisibility, this.reportInvalidJavadocVisibility);
}
Expand Down Expand Up @@ -612,4 +613,100 @@ public static void main(String[] args) {
this.reportMissingJavadocTags = bkup;
}
}
public void test022() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runConformTest(new String[] {
"X.java",
"""
import java.lang.annotation.Documented;
/**
* Reference type {@link Documented}:
*/
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"Hello");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
public void test023() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runNegativeTest(new String[] {
"X.java",
"""
import java.lang.annotation.Documented;
/**
* Reference type but no reference here - :
*/
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"----------\n" +
"1. ERROR in X.java (at line 1)\n" +
" import java.lang.annotation.Documented;\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The import java.lang.annotation.Documented is never used\n" +
"----------\n");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
public void test024() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runConformTest(new String[] { "X.java",
"""
import java.lang.annotation.Documented;
///
/// Reference type {@link Documented}:
///
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"Hello");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
public void test025() {
String bkup = this.reportMissingJavadocTags;
try {
this.reportMissingJavadocTags = CompilerOptions.IGNORE;
this.runNegativeTest(new String[] { "X.java",
"""
import java.lang.annotation.Documented;
///
/// Reference type but no reference here:
///
public class X {
public static void main(String[] args) {
System.out.println("Hello");
}
}
"""},
"----------\n" +
"1. ERROR in X.java (at line 1)\n" +
" import java.lang.annotation.Documented;\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The import java.lang.annotation.Documented is never used\n" +
"----------\n");
} finally {
this.reportMissingJavadocTags = bkup;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5483,4 +5483,65 @@ interface I {
assertEquals(1, variableElement.getSourceRange().getLength());
}

public void testSVDStartPositionIssue_1() throws JavaModelException {
String contents = """
public class X {
public static void example() {
try {
System.out.println("try");
}
/** */
catch (RuntimeException e) {
System.out.println("catch");
}
}
}
""";
this.workingCopy = getWorkingCopy("/Converter22/src/xyz/X.java", true/*resolve*/);
CompilationUnit cu = (CompilationUnit) buildAST(contents, this.workingCopy);
TypeDeclaration typedeclaration = (TypeDeclaration) getASTNode(cu, 0);
MethodDeclaration methodDeclaration = (MethodDeclaration) typedeclaration.bodyDeclarations().get(0);
Block block = methodDeclaration.getBody();
List<ASTNode> statements = block.statements();
TryStatement tryStatement = (TryStatement) statements.get(0);
List<ASTNode> catchClauseList = tryStatement.catchClauses();
CatchClause catchClause = (CatchClause) catchClauseList.get(0);
SingleVariableDeclaration svd = catchClause.getException();

assertEquals("Not a Single Variable Declaration", ASTNode.SINGLE_VARIABLE_DECLARATION, svd.getNodeType());
assertEquals("Not a Simple Type", ASTNode.SIMPLE_TYPE, svd.getType().getNodeType());
assertEquals("Not a Simple Name", ASTNode.SIMPLE_NAME, svd.getName().getNodeType());
assertEquals("Single Variable Declaration length is not correct", svd.getLength(), contents.substring(contents.indexOf("RuntimeException e")).indexOf(')'));
assertEquals("Single Variable Declaration startPosition is not correct", svd.getStartPosition(), contents.indexOf("RuntimeException"));
}

public void testSVDStartPositionIssue_2() throws JavaModelException {
String contents = """
public class X {
public static void example() {
try {
System.out.println("try");
}
/** */
catch(/** abc*/ RuntimeException e) {
System.out.println("catch");
}
}
}
""";
this.workingCopy = getWorkingCopy("/Converter22/src/xyz/X.java", true/*resolve*/);
CompilationUnit cu = (CompilationUnit) buildAST(contents, this.workingCopy);
TypeDeclaration typedeclaration = (TypeDeclaration) getASTNode(cu, 0);
MethodDeclaration methodDeclaration = (MethodDeclaration) typedeclaration.bodyDeclarations().get(0);
Block block = methodDeclaration.getBody();
List<ASTNode> statements = block.statements();
TryStatement tryStatement = (TryStatement) statements.get(0);
List<ASTNode> catchClauseList = tryStatement.catchClauses();
CatchClause catchClause = (CatchClause) catchClauseList.get(0);
SingleVariableDeclaration svd = catchClause.getException();

assertEquals("Single Variable Declaration length is not correct", svd.getLength(), contents.substring(contents.indexOf("/** abc*/ RuntimeException e")).indexOf(')'));
assertEquals("Single Variable Declaration startPosition is not correct", svd.getStartPosition(), contents.indexOf("/** abc*/ RuntimeException"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ public int flushCommentsDefinedPriorTo(int position) {
return position;
}

@Override
protected void consumeExitTryBlock() {
flushCommentsDefinedPriorTo(this.scanner.currentPosition);
super.consumeExitTryBlock();
}

protected int getCommentPtr() {
int lastComment = this.scanner.commentPtr;
if (lastComment == -1 && this.currentElement != null) {
Expand Down
24 changes: 0 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-p2-extras-plugin</artifactId>
<version>${tycho.version}</version>
<executions>
<execution> <!-- Checks versions are properly bumped from one stream to the other -->
<id>compare-attached-artifacts-with-release</id>
<goals>
<goal>compare-version-with-baselines</goal>
</goals>
<configuration>
<skip>${compare-version-with-baselines.skip}</skip>
<baselines>
<baseline>${previous-release.baseline}</baseline>
</baselines>
<comparator>zip</comparator>
<ignoredPatterns>
<pattern>META-INF/ECLIPSE_.RSA</pattern>
<pattern>META-INF/ECLIPSE_.SF</pattern>
</ignoredPatterns>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down

0 comments on commit c0b884e

Please sign in to comment.