Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/BETA_JAVA22'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Jenkinsfile
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java

Change-Id: I128c9bb3760c4559b7cb7613c4aefe65bcc52b0e
  • Loading branch information
jarthana committed Mar 20, 2024
2 parents 16766b5 + 4034811 commit df543ef
Show file tree
Hide file tree
Showing 167 changed files with 6,632 additions and 2,387 deletions.
5 changes: 2 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pipeline {
steps {
sh """#!/bin/bash -x
# /opt/tools/java/openjdk/jdk-11/latest/bin/java -version
java -version
mkdir -p $WORKSPACE/tmp
Expand All @@ -32,11 +31,11 @@ pipeline {
mvn clean install -f org.eclipse.jdt.core.compiler.batch -DlocalEcjVersion=99.99 -Dmaven.repo.local=$WORKSPACE/.m2/repository -DcompilerBaselineMode=disable -DcompilerBaselineReplace=none
mvn -U clean verify --batch-mode --fail-at-end -Dmaven.repo.local=$WORKSPACE/.m2/repository \
-Ptest-on-javase-21 -Pbree-libs -Papi-check -Pjavadoc -Pp2-repo \
-Ptest-on-javase-22 -Pbree-libs -Papi-check -Pjavadoc -Pp2-repo \
-Dmaven.test.failure.ignore=true \
-Dcompare-version-with-baselines.skip=false \
-Djava.io.tmpdir=$WORKSPACE/tmp -Dproject.build.sourceEncoding=UTF-8 \
-Dtycho.surefire.argLine="--add-modules ALL-SYSTEM -Dcompliance=1.8,11,17,20,21 -Djdt.performance.asserts=disabled" \
-Dtycho.surefire.argLine="--add-modules ALL-SYSTEM -Dcompliance=1.8,11,17,21,22 -Djdt.performance.asserts=disabled" \
-DDetectVMInstallationsJob.disabled=true \
-Dtycho.apitools.debug \
-Dtycho.debug.artifactcomparator \
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.annotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.core</artifactId>
<groupId>org.eclipse.jdt</groupId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jdt.annotation</artifactId>
<version>2.3.0-SNAPSHOT</version>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.annotation_v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.core</artifactId>
<groupId>org.eclipse.jdt</groupId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jdt.annotation</artifactId>
<version>1.2.100-SNAPSHOT</version>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.apt.pluggable.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.jdt</groupId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.apt.pluggable.tests</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.jdt.apt.tests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012, 2016 Eclipse Foundation and others.
Copyright (c) 2012, 2024 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
Expand All @@ -15,7 +15,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.jdt</groupId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.apt.tests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.compiler.apt.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.jdt</groupId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.compiler.apt.tests</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2023 IBM Corporation.
* Copyright (c) 2020, 2024 IBM Corporation.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -31,7 +31,7 @@
public class RecordElementsTests extends TestCase {
private static final String MODULE_PROC = "org.eclipse.jdt.compiler.apt.tests.processors.elements.RecordElementProcessor";

public void testPreviewFlagTrue() throws IOException {
public void _testPreviewFlagTrue() throws IOException {
if (!isRunning21()) {
return;
}
Expand Down Expand Up @@ -192,8 +192,8 @@ protected void internalTestWithPreview(JavaCompiler compiler, String processor,
options.add("-source");
options.add(compliance);
}
if (preview)
options.add("--enable-preview");
// if (preview)
// options.add("--enable-preview");
BatchTestUtils.compileInModuleMode(compiler, options, processor, targetFolder, null, true, processBinaries);
// If it succeeded, the processor will have set this property to "succeeded";
// if not, it will set it to an error value.
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.compiler.tool.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.jdt</groupId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.compiler.tool.tests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.core.compiler.batch/.settings/.api_filters
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jdt.core.compiler.batch" version="2">
<resource path="src/org/eclipse/jdt/core/compiler/CategorizedProblem.java" type="org.eclipse.jdt.core.compiler.CategorizedProblem">
<filter id="576725006">
<filter comment="BETA_JAVA22 temporary issue" id="576725006">
<message_arguments>
<message_argument value="IProblem"/>
<message_argument value="CategorizedProblem"/>
Expand Down
3 changes: 2 additions & 1 deletion org.eclipse.jdt.core.compiler.batch/forceQualifierUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Comparator errors in I20230607-0720
Comparator errors in I20230906-0400
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1388
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1388
https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/issues/1759
15 changes: 11 additions & 4 deletions org.eclipse.jdt.core.compiler.batch/grammar/java.g
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,6 @@ InternalCompilationUnit ::= PackageDeclaration TypeDeclarations
/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
InternalCompilationUnit ::= ImportDeclarations ReduceImports
/.$putCase consumeInternalCompilationUnit(); $break ./
InternalCompilationUnit ::= TypeDeclarations
/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
InternalCompilationUnit ::= ImportDeclarations ReduceImports TypeDeclarations
/.$putCase consumeInternalCompilationUnitWithTypes(); $break ./
InternalCompilationUnit ::= $empty
/.$putCase consumeEmptyInternalCompilationUnit(); $break ./
/:$readableName CompilationUnit:/
Expand All @@ -453,6 +449,12 @@ ModuleDeclaration ::= ModuleHeader ModuleBody
/:$compliance 9:/
/.$putCase consumeModuleDeclaration(); $break ./

-- JEP 445: unnamed class, this may capture type declarations without unnamed class, this case is fixed/reduced upon completion of parsing
InternalCompilationUnit ::= UnnamedClassBodyDeclarations
/.$putCase consumeInternalCompilationUnitWithPotentialUnnamedClass(); $break ./
InternalCompilationUnit ::= ImportDeclarations ReduceImports UnnamedClassBodyDeclarations
/.$putCase consumeInternalCompilationUnitWithPotentialUnnamedClass(); $break ./

-- to work around shift/reduce conflicts, we allow Modifiersopt in order to support annotations
-- in a module declaration, and then report errors if any modifiers other than annotations are
-- encountered
Expand Down Expand Up @@ -746,6 +748,11 @@ ClassBodyDeclarations ::= ClassBodyDeclarations ClassBodyDeclaration
ClassBodyDeclaration -> ClassMemberDeclaration
ClassBodyDeclaration -> StaticInitializer
ClassBodyDeclaration -> ConstructorDeclaration

UnnamedClassBodyDeclarations -> ClassMemberDeclaration
UnnamedClassBodyDeclarations ::= ClassMemberDeclaration UnnamedClassBodyDeclarations
/.$putCase consumeUnnamedClassBodyDeclarations(); $break ./
/:$readableName UnnamedClassBodyDeclarations:/
--1.1 feature
ClassBodyDeclaration ::= Diet NestedMethod CreateInitializer Block
/.$putCase consumeClassBodyDeclaration(); $break ./
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.jdt.core.compiler.batch/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012, 2021 Eclipse Foundation and others.
Copyright (c) 2012, 2024 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
Expand All @@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.core</artifactId>
<groupId>org.eclipse.jdt</groupId>
<version>4.32.0-SNAPSHOT</version>
<version>4.31.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jdt.core.compiler.batch</artifactId>
<version>3.38.0-SNAPSHOT</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2454,6 +2454,10 @@ public interface IProblem {
*/
int PatternVariableRedeclared = Internal + 1784;

/** @since 3.38
*/
int DimensionsIllegalOnRecordPattern = Internal + 1785;

/** @since 3.28
*/
int DiscouragedValueBasedTypeSynchronization = Internal + 1820;
Expand Down Expand Up @@ -2585,20 +2589,37 @@ public interface IProblem {
*/
int NamedPatternVariablesDisallowedHere = Internal + 1942;

/**
* @since 3.38
*/
int ImplicitClassMissingMainMethod = PreviewRelated + 1950;

/**
* @since 3.35
*/
int SyntheticAccessorNotEnclosingMethod = MethodRelated + 1990;

/**
* @since 3.37
* @since 3.38
* @noreference preview feature
*/
int UnderscoreCannotBeUsedHere = PreviewRelated + 2000;
/**
* @since 3.37
* @since 3.38
* @noreference preview feature
*/
int UnnamedVariableMustHaveInitializer = PreviewRelated + 2001;

/**
* @since 3.38
* @noreference preview feature
*/
int ExpressionInPreConstructorContext = PreviewRelated + 2022;

/**
* @since 3.38
* @noreference preview feature
*/
int DisallowedStatementInPrologue = PreviewRelated + 2023;

}
Original file line number Diff line number Diff line change
Expand Up @@ -1019,4 +1019,12 @@ public boolean visit(SwitchExpression switchExpression, BlockScope blockScope) {
public boolean visit(RecordComponent recordComponent, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
public boolean visit(StringTemplate expr, BlockScope scope1) {
// TODO Auto-generated method stub
return false;
}
public boolean visit(TemplateExpression expr, BlockScope scope1) {
// TODO Auto-generated method stub
return false;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2021 GK Software SE and others.
* Copyright (c) 2021, 2024 GK Software SE and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -444,6 +444,10 @@ public boolean visit(StringLiteralConcatenation literal, BlockScope scope) {
return visitNode(literal);
}

@Override
public boolean visit(StringTemplate expr, BlockScope scope1) {
return visitNode(expr);
}
@Override
public boolean visit(NormalAnnotation annotation, BlockScope scope) {
return visitNode(annotation);
Expand Down Expand Up @@ -594,6 +598,10 @@ public boolean visit(SynchronizedStatement synchronizedStatement, BlockScope sco
return visitNode(synchronizedStatement);
}

@Override
public boolean visit(TemplateExpression templateExpression, BlockScope scope) {
return visitNode(templateExpression);
}
@Override
public boolean visit(ThisReference thisReference, BlockScope scope) {
return visitNode(thisReference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ public boolean isStatic() {
return (this.modifiers & ClassFileConstants.AccStatic) != 0;
}

public boolean isCandidateMain() {
return false;
}

/**
* Fill up the method body with statement
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2014 IBM Corporation and others.
* Copyright (c) 2000, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,28 @@ public TypeBinding resolveType(BlockScope scope) {
this.binding.getTypeAnnotations() != Binding.NO_ANNOTATIONS) {
this.resolvedType = scope.environment().createAnnotatedType(this.resolvedType, this.binding.getTypeAnnotations());
}
checkPreConstructorContext(scope);
return this.resolvedType;
}

protected void checkPreConstructorContext(BlockScope scope) {
if (this.inPreConstructorContext && this.type != null &&
this.type.resolvedType instanceof ReferenceBinding currentType
&& !(currentType.isStatic() || currentType.isInterface())) { // no enclosing instance
MethodScope ms = scope.methodScope();
MethodBinding method = ms != null ? ms.referenceMethodBinding() : null;
ReferenceBinding declaringClass = method != null ? method.declaringClass : null;
if (declaringClass != null) {
while ((currentType = currentType.enclosingType())!= null) {
if (TypeBinding.equalsEquals(declaringClass, currentType)) {
scope.problemReporter().errorExpressionInPreConstructorContext(this);
break;
}
}
}
}
}

/**
* Check if 'allocationType' illegally has a top-level null annotation.
*/
Expand Down
Loading

0 comments on commit df543ef

Please sign in to comment.