diff --git a/groovy-eclipse.setup b/groovy-eclipse.setup
index 5e6719c510..28da0ecdb7 100644
--- a/groovy-eclipse.setup
+++ b/groovy-eclipse.setup
@@ -305,7 +305,7 @@
+ url="https://download.eclipse.org/eclipse/updates/4.30-I-builds/I20231109-0710"/>
diff --git a/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/actions/OrganizeImportsTestSuite.groovy b/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/actions/OrganizeImportsTestSuite.groovy
index 876d0c4165..75a5f70690 100644
--- a/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/actions/OrganizeImportsTestSuite.groovy
+++ b/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/actions/OrganizeImportsTestSuite.groovy
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import org.codehaus.groovy.eclipse.test.GroovyEclipseTestSuite
import org.eclipse.core.resources.IProject
import org.eclipse.jdt.core.ICompilationUnit
import org.eclipse.jdt.core.ISourceRange
-import org.eclipse.jdt.core.JavaCore
import org.eclipse.jdt.core.groovy.tests.ReconcilerUtils
import org.eclipse.jdt.core.search.TypeNameMatch
import org.eclipse.jdt.core.tests.util.Util
@@ -78,10 +77,7 @@ abstract class OrganizeImportsTestSuite extends GroovyEclipseTestSuite {
withProject { IProject project ->
Util.delete(project.getFile('config.groovy'))
}
-
- JavaCore.options = JavaCore.options.tap {
- remove(OPTIONG_GroovyCompilerConfigScript)
- }
+ setJavaPreference(OPTIONG_GroovyCompilerConfigScript, null)
}
protected void addConfigScript(CharSequence contents) {
diff --git a/jdt-patch/e430/Feature-org.codehaus.groovy.jdt.patch/feature.xml b/jdt-patch/e430/Feature-org.codehaus.groovy.jdt.patch/feature.xml
index b1e386dda6..27ea03ade5 100644
--- a/jdt-patch/e430/Feature-org.codehaus.groovy.jdt.patch/feature.xml
+++ b/jdt-patch/e430/Feature-org.codehaus.groovy.jdt.patch/feature.xml
@@ -18,7 +18,7 @@
-
+ = this.contents.length) {
resizeContents(3);
@@ -4702,7 +4698,6 @@ private boolean jdk16packageInfoAnnotation(final long annotationMask, final long
return false;
}
/**
- * @param annotations
* @param targetMask allowed targets
* @return the number of attributes created while dumping the annotations in the .class file
*/
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/CompilationResult.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/CompilationResult.java
index c10b3aa4f9..7bee2b6041 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/CompilationResult.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/CompilationResult.java
@@ -68,7 +68,7 @@ public class CompilationResult {
public ICompilationUnit compilationUnit;
private Map problemsMap;
private Set firstErrors;
- private int maxProblemPerUnit;
+ private final int maxProblemPerUnit;
public char[][][] qualifiedReferences;
public char[][] simpleNameReferences;
public char[][] rootReferences;
@@ -87,6 +87,7 @@ public class CompilationResult {
private int numberOfErrors;
private boolean hasMandatoryErrors;
public List annotations = new ArrayList<>(1);
+ private List scheduledProblems;
private static final int[] EMPTY_LINE_ENDS = Util.EMPTY_INT_ARRAY;
private static final Comparator PROBLEM_COMPARATOR = new Comparator() {
@@ -480,4 +481,18 @@ public String toString(){
}
return buffer.toString();
}
+
+public void scheduleProblem(Runnable task) {
+ if (this.scheduledProblems == null)
+ this.scheduledProblems = new ArrayList<>();
+ this.scheduledProblems.add(task);
+}
+
+public void materializeProblems() {
+ if (this.scheduledProblems != null) {
+ for (Runnable task : this.scheduledProblems) {
+ task.run();
+ }
+ }
+}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java
index d40740549f..b5f40724a3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java
@@ -30,7 +30,6 @@
import java.io.*;
import java.util.*;
-@SuppressWarnings("rawtypes")
public class Compiler implements ITypeRequestor, ProblemSeverities {
public Parser parser;
public ICompilerRequestor requestor;
@@ -162,7 +161,7 @@ public Compiler(
public Compiler(
INameEnvironment environment,
IErrorHandlingPolicy policy,
- Map settings,
+ Map settings,
final ICompilerRequestor requestor,
IProblemFactory problemFactory,
boolean parseLiteralExpressionsAsConstants) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java
index 85b77255e5..c8d8bd9ac1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java
@@ -20,7 +20,6 @@ public class DefaultErrorHandlingPolicies {
*
* Typically, the #proceedWithProblems(Problem[]) should
* show the problems.
- *
*/
public static IErrorHandlingPolicy exitAfterAllProblems() {
return new IErrorHandlingPolicy() {
@@ -41,7 +40,6 @@ public boolean ignoreAllErrors() {
/*
* Exit without proceeding on the first problem wich appears
* to be an error.
- *
*/
public static IErrorHandlingPolicy exitOnFirstError() {
return new IErrorHandlingPolicy() {
@@ -61,7 +59,6 @@ public boolean ignoreAllErrors() {
}
/*
* Proceed on the first error met.
- *
*/
public static IErrorHandlingPolicy proceedOnFirstError() {
return new IErrorHandlingPolicy() {
@@ -81,7 +78,6 @@ public boolean ignoreAllErrors() {
}
/*
* Accumulate all problems, then proceed with them.
- *
*/
public static IErrorHandlingPolicy proceedWithAllProblems() {
return new IErrorHandlingPolicy() {
@@ -101,7 +97,6 @@ public boolean ignoreAllErrors() {
}
/*
* Accumulate all problems, then proceed with them, but never report them.
- *
*/
public static IErrorHandlingPolicy ignoreAllProblems() {
return new IErrorHandlingPolicy() {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseMessagerImpl.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseMessagerImpl.java
index a8aa4cb6ef..fd51160eba 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseMessagerImpl.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseMessagerImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2020 BEA Systems, Inc. and others
+ * Copyright (c) 2007, 2023 BEA Systems, Inc. and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -57,6 +57,7 @@ public class BaseMessagerImpl {
* @param e the element against which to report the message. If the element is not
* in the set of elements being compiled in the current round, the reference context
* and filename will be set to null.
+ * @return a new {@link AptProblem}
*/
public static AptProblem createProblem(Kind kind, CharSequence msg, Element e,
AnnotationMirror a, AnnotationValue v) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
index 07f63a57eb..135fb7aede 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java
@@ -58,11 +58,11 @@ public abstract class BaseProcessingEnvImpl implements ProcessingEnvironment {
// Initialized in this base class:
protected Elements _elementUtils;
protected Types _typeUtils;
- private List _addedUnits;
- private List _addedClassFiles;
- private List _deletedUnits;
+ private final List _addedUnits;
+ private final List _addedClassFiles;
+ private final List _deletedUnits;
private boolean _errorRaised;
- private Factory _factory;
+ private final Factory _factory;
public ModuleBinding _current_module;
public BaseProcessingEnvImpl() {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java
index 2751565e5f..c46738eb4e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -34,7 +34,7 @@
/**
* Java 6 annotation processor manager used when compiling from the command line
- * or via the {@link javax.tools.JavaCompiler} interface.
+ * or via the javax.tools.JavaCompiler interface.
*/
public class BatchAnnotationProcessorManager extends BaseAnnotationProcessorManager
{
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java
index d9c035afc1..a668e44dde 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java
@@ -200,7 +200,7 @@ public String toString() {
*/
private boolean _closed = false;
- private String _typeName;
+ private final String _typeName;
public HookedJavaFileObject(JavaFileObject fileObject, String fileName, String typeName, BatchFilerImpl filer) {
super(fileObject);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/IProcessorProvider.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/IProcessorProvider.java
index 5e88da3580..ae4e7dc751 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/IProcessorProvider.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/IProcessorProvider.java
@@ -44,7 +44,6 @@ public interface IProcessorProvider {
* unchecked exception, etc; the caller should not assume that this method will return.
*
* @param p the processor, if known, or null if not.
- * @param e
*/
void reportProcessorException(Processor p, Exception e);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundDispatcher.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundDispatcher.java
index 78bb434bff..15131a4832 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundDispatcher.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/RoundDispatcher.java
@@ -49,7 +49,6 @@ public class RoundDispatcher {
* avoid modifying the set passed in.
* @param traceProcessorInfo a PrintWriter that processor trace output will be sent
* to, or null if tracing is not desired.
- * @param traceRounds
*/
public RoundDispatcher(
IProcessorProvider provider,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationValueImpl.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationValueImpl.java
index 9377244594..d11e047d61 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationValueImpl.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/AnnotationValueImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2017 IBM Corporation and others.
+ * Copyright (c) 2005, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -124,6 +124,7 @@ public AnnotationValueImpl(BaseProcessingEnvImpl env, Object value, TypeBinding
* BaseTypeBinding, this is ignored and the value is inspected to determine type.
* @param kind an int array whose first element will be set to the type of the
* converted object, represented with T_* values from TypeIds or from this class.
+ * @return converted mirror type
*/
private Object convertToMirrorType(Object value, TypeBinding type, int kind[]) {
if (type == null) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableTypeImpl.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableTypeImpl.java
index a95bb4a72f..4beec43887 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableTypeImpl.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableTypeImpl.java
@@ -34,7 +34,6 @@
/**
* Implementation of the ExecutableType
- *
*/
public class ExecutableTypeImpl extends TypeMirrorImpl implements ExecutableType {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
index f8503e1b67..75da09e4cc 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java
@@ -585,7 +585,6 @@ public ErrorType getErrorType(ReferenceBinding binding) {
*
* @param value the current value from the annotation instance.
* @param expectedType the expected type of the value.
- *
*/
public static Object performNecessaryPrimitiveTypeConversion(
final Class> expectedType,
@@ -776,9 +775,6 @@ else if( value instanceof Boolean ){
/**
* Set an element of an array to the appropriate dummy value type
- * @param array
- * @param i
- * @param expectedLeafType
*/
public static void setArrayMatchingDummyValue(Object array, int i, Class> expectedLeafType)
{
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java
index 5ea8f05c49..4212db5f3f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2021 IBM Corporation and others.
+ * Copyright (c) 2005, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -56,7 +56,6 @@ public class TypeElementImpl extends ElementImpl implements TypeElement {
/**
* Compares Element instances possibly returned by
* {@link TypeElement#getEnclosedElements()} based on their source location, if available.
- *
*/
private static final class SourceLocationComparator implements Comparator {
private final IdentityHashMap sourceStartCache = new IdentityHashMap<>();
@@ -128,7 +127,8 @@ private int determineSourceStart(ElementImpl e) {
private final ElementKind _kindHint;
/**
- * In general, clients should call {@link Factory#newElement(Binding)} to create new instances.
+ * In general, clients should call {@link Factory#newElement(org.eclipse.jdt.internal.compiler.lookup.Binding)}
+ * to create new instances.
*/
TypeElementImpl(BaseProcessingEnvImpl env, ReferenceBinding binding, ElementKind kindHint) {
super(env, binding);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java
index 493b865757..a6502f35b6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeParameterElementImpl.java
@@ -38,9 +38,6 @@
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
-/**
- *
- */
public class TypeParameterElementImpl extends ElementImpl implements TypeParameterElement
{
private final Element _declaringElement;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
index c91855bfaf..21246d36fc 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
@@ -1051,7 +1051,7 @@ public static void resolveAnnotations(BlockScope scope, Annotation[] sourceAnnot
By construction the bindings associated with QTR, PQTR etc get resolved first and then annotations for different levels get resolved
and applied at one go. Likewise for multidimensional arrays.
- @Returns the annotated type binding.
+ @return the annotated type binding.
*/
public static TypeBinding resolveAnnotations(BlockScope scope, Annotation[][] sourceAnnotations, TypeBinding type) {
int levels = sourceAnnotations == null ? 0 : sourceAnnotations.length;
@@ -1071,7 +1071,6 @@ public static TypeBinding resolveAnnotations(BlockScope scope, Annotation[][] so
/**
* "early" handling of NonNullByDefault because for local variables annotations are resolved after their type because of bug
* 96991.
- * @param localDeclaration
*/
public static void handleNonNullByDefault(BlockScope scope, Annotation[] sourceAnnotations, LocalDeclaration localDeclaration) {
if (sourceAnnotations == null || sourceAnnotations.length == 0) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
index 3ad1308086..c86fd84e0e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -257,8 +257,6 @@ public CompilationResult compilationResult() {
/**
* Bytecode generation for a method
- * @param classScope
- * @param classFile
*/
public void generateCode(ClassScope classScope, ClassFile classFile) {
@@ -487,8 +485,6 @@ public boolean isStatic() {
/**
* Fill up the method body with statement
- * @param parser
- * @param unit
*/
public abstract void parseStatements(Parser parser, CompilationUnitDeclaration unit);
@@ -651,14 +647,15 @@ public void resolveJavadoc() {
// Set javadoc visibility
int javadocVisibility = this.binding.modifiers & ExtraCompilerModifiers.AccVisibilityMASK;
ClassScope classScope = this.scope.classScope();
- ProblemReporter reporter = this.scope.problemReporter();
- int severity = reporter.computeSeverity(IProblem.JavadocMissing);
- if (severity != ProblemSeverities.Ignore) {
- if (classScope != null) {
- javadocVisibility = Util.computeOuterMostVisibility(classScope.referenceType(), javadocVisibility);
+ try (ProblemReporter reporter = this.scope.problemReporter()) {
+ int severity = reporter.computeSeverity(IProblem.JavadocMissing);
+ if (severity != ProblemSeverities.Ignore) {
+ if (classScope != null) {
+ javadocVisibility = Util.computeOuterMostVisibility(classScope.referenceType(), javadocVisibility);
+ }
+ int javadocModifiers = (this.binding.modifiers & ~ExtraCompilerModifiers.AccVisibilityMASK) | javadocVisibility;
+ reporter.javadocMissing(this.sourceStart, this.sourceEnd, severity, javadocModifiers);
}
- int javadocModifiers = (this.binding.modifiers & ~ExtraCompilerModifiers.AccVisibilityMASK) | javadocVisibility;
- reporter.javadocMissing(this.sourceStart, this.sourceEnd, severity, javadocModifiers);
}
}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index e7c62fd53d..da09b09f9c 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -597,13 +597,17 @@ public MethodBinding inferConstructorOfElidedParameterizedType(final Scope scope
MethodBinding constructor = inferDiamondConstructor(scope, this, this.type.resolvedType, this.argumentTypes, inferredReturnTypeOut);
if (constructor != null) {
this.inferredReturnType = inferredReturnTypeOut[0];
- if (constructor instanceof ParameterizedGenericMethodBinding && scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_8) {
- // force an inference context to be established for nested poly allocations (to be able to transfer b2), but avoid tunneling through overload resolution. We know this is the MSMB.
- if (this.expressionContext == INVOCATION_CONTEXT && this.typeExpected == null)
+ if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_8
+ && this.expressionContext == INVOCATION_CONTEXT && this.typeExpected == null) { // not ready for invocation type inference
+ if (constructor instanceof PolyParameterizedGenericMethodBinding) {
+ return constructor; // keep this placeholder binding, which also serves as a key into #inferenceContexts
+ } else if (constructor instanceof ParameterizedGenericMethodBinding) {
+ // force an inference context to be established for nested poly allocations (to be able to transfer b2), but avoid tunneling through overload resolution. We know this is the MSMB.
constructor = ParameterizedGenericMethodBinding.computeCompatibleMethod18(constructor.shallowOriginal(), this.argumentTypes, scope, this);
- }
- if (this.typeExpected != null && this.typeExpected.isProperType(true))
+ }
+ } else if (this.typeExpected != null && this.typeExpected.isProperType(true)) {
registerResult(this.typeExpected, constructor);
+ }
}
return constructor;
}
@@ -616,6 +620,8 @@ public static MethodBinding inferDiamondConstructor(Scope scope, InvocationSite
// Given the allocation type and the arguments to the constructor, see if we can infer the constructor of the elided parameterized type.
MethodBinding factory = scope.getStaticFactory(allocationType, enclosingType, argumentTypes, site);
if (factory instanceof ParameterizedGenericMethodBinding && factory.isValidBinding()) {
+ if (site.invocationTargetType() == null && site.getExpressionContext().definesTargetType() && factory instanceof PolyParameterizedGenericMethodBinding)
+ return factory; // during applicability inference keep the PolyParameterizedGenericMethodBinding
ParameterizedGenericMethodBinding genericFactory = (ParameterizedGenericMethodBinding) factory;
inferredReturnTypeOut[0] = genericFactory.inferredReturnType;
SyntheticFactoryMethodBinding sfmb = (SyntheticFactoryMethodBinding) factory.original();
@@ -671,7 +677,7 @@ public void checkTypeArgumentRedundancy(ParameterizedTypeBinding allocationType,
break;
}
if (i == allocationType.arguments.length) {
- scope.problemReporter().redundantSpecificationOfTypeArguments(this.type, allocationType.arguments);
+ reportTypeArgumentRedundancyProblem(allocationType, scope);
return;
}
}
@@ -838,4 +844,4 @@ public int nameSourceEnd() {
else
return this.type.sourceEnd;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
index 7ebdb78807..c94d9a6613 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
@@ -150,7 +150,6 @@ public StringBuffer printStatement(int tab, StringBuffer output) {
/**
* Case code generation
- *
*/
@Override
public void generateCode(BlockScope currentScope, CodeStream codeStream) {
@@ -199,8 +198,8 @@ public static class ResolvedCase {
public TypeBinding t; // For ease of access. This.e contains the type binding anyway.
public int index;
private int intValue;
- private boolean isPattern;
- private boolean isQualifiedEnum;
+ private final boolean isPattern;
+ private final boolean isQualifiedEnum;
public int enumDescIdx;
public int classDescIdx;
ResolvedCase(Constant c, Expression e, TypeBinding t, int index, boolean isQualifiedEnum) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
index f1b2eb7173..17fb0f8e0e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
@@ -246,6 +246,7 @@ public TypeDeclaration declarationOfType(char[][] typeName) {
}
public void finalizeProblems() {
+ this.compilationResult.materializeProblems();
int problemCount = this.compilationResult.problemCount;
CategorizedProblem[] problems = this.compilationResult.problems;
if (this.suppressWarningsCount == 0) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
index 8bd10b4613..6ef69c8b40 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java
@@ -155,7 +155,6 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
/**
* Do statement code generation
- *
*/
@Override
public void generateCode(BlockScope currentScope, CodeStream codeStream) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
index 2e67a40201..bb662468eb 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java
@@ -486,7 +486,6 @@ public void generateOptimizedBooleanEqual(BlockScope currentScope, CodeStream co
}
/**
* Boolean generation for == with non-boolean operands
- *
*/
public void generateNonBooleanEqual(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
@@ -695,7 +694,6 @@ public void generateNonBooleanEqual(BlockScope currentScope, CodeStream codeStre
/**
* Boolean generation for == with non-boolean operands
- *
*/
public void generateOptimizedNonBooleanEqual(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java
index f647d1ccfd..52a21ad7c4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -247,10 +247,6 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
* More sophisticated for of the flow analysis used for analyzing expressions, and be able to optimize out
* portions of expressions where no actual value is required.
*
- * @param currentScope
- * @param flowContext
- * @param flowInfo
- * @param valueRequired
* @return The state of initialization after the analysis of the current expression
*/
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired) {
@@ -825,11 +821,6 @@ public void propagatePatternVariablesInScope(LocalVariableBinding[] vars, BlockS
/**
* Default generation of a boolean value
- * @param currentScope
- * @param codeStream
- * @param trueLabel
- * @param falseLabel
- * @param valueRequired
*/
public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired) {
// a label valued to nil means: by default we fall through the case...
@@ -1174,7 +1165,6 @@ public TypeBinding resolveExpressionType(BlockScope scope) {
/**
* Resolve the type of this expression in the context of a blockScope
*
- * @param scope
* @return
* Return the actual type of this expression after resolution
*/
@@ -1186,7 +1176,6 @@ public TypeBinding resolveType(BlockScope scope) {
/**
* Resolve the type of this expression in the context of a classScope
*
- * @param scope
* @return
* Return the actual type of this expression after resolution
*/
@@ -1351,9 +1340,6 @@ public void tagAsNeedCheckCast() {
/**
* Record the fact a cast expression got detected as being unnecessary.
- *
- * @param scope
- * @param castType
*/
public void tagAsUnnecessaryCast(Scope scope, TypeBinding castType) {
// do nothing by default
@@ -1372,8 +1358,6 @@ public Expression toTypeReference() {
/**
* Traverse an expression in the context of a blockScope
- * @param visitor
- * @param scope
*/
@Override
public void traverse(ASTVisitor visitor, BlockScope scope) {
@@ -1382,8 +1366,6 @@ public void traverse(ASTVisitor visitor, BlockScope scope) {
/**
* Traverse an expression in the context of a classScope
- * @param visitor
- * @param scope
*/
public void traverse(ASTVisitor visitor, ClassScope scope) {
// nothing to do
@@ -1426,4 +1408,4 @@ public boolean isPotentiallyCompatibleWith(TypeBinding targetType, Scope scope)
protected Constant optimizedNullComparisonConstant() {
return Constant.NotAConstant;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java
index 9ea39f5656..7199c2a9e7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java
@@ -20,7 +20,6 @@
* Sole purpose of {@link FakeDefaultLiteral} is to appear
* in case 'default' of switch patterns (JEP 406 at the time
* of writing this comment)
- *
*/
public class FakeDefaultLiteral extends MagicLiteral {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java
index 9dcd98b004..f36feebdd3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java
@@ -174,7 +174,6 @@ public void resolve (BlockScope scope) {
*
value is a local variable reference, create tracking variable it if needed.
*
value is an allocation expression, return a preliminary tracking variable if set.
*
- * @param expression
* @return a new {@link FakedTrackingVariable} or null.
*/
public static FakedTrackingVariable getCloseTrackingVariable(Expression expression, FlowInfo flowInfo, FlowContext flowContext) {
@@ -535,7 +534,6 @@ private static FakedTrackingVariable findCloseTracker(BlockScope scope, FlowInfo
* @param scope scope containing the assignment
* @param upstreamInfo info without analysis of the rhs, use this to determine the status of a resource being disconnected
* @param flowInfo info with analysis of the rhs, use this for recording resource status because this will be passed downstream
- * @param flowContext
* @param location where to report warnigs/errors against
* @param rhs the right hand side of the assignment, this expression is to be analyzed.
* The caller has already checked that the rhs is either of a closeable type or null.
@@ -796,8 +794,6 @@ public int findMostSpecificStatus(FlowInfo flowInfo, BlockScope currentScope, Bl
/**
* Get the null status looking even into unreachable flows
- * @param local
- * @param flowInfo
* @return one of the constants FlowInfo.{NULL,POTENTIALLY_NULL,POTENTIALLY_NON_NULL,NON_NULL}.
*/
private int getNullStatusAggressively(LocalVariableBinding local, FlowInfo flowInfo) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java
index 14a0d1074b..6c19fac12c 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java
@@ -21,9 +21,9 @@
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class FalseLiteral extends MagicLiteral {
-
+
static final char[] source = {'f', 'a', 'l', 's', 'e'};
-
+
public FalseLiteral(int s , int e) {
super(s,e);
}
@@ -66,9 +66,6 @@ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStr
public TypeBinding literalType(BlockScope scope) {
return TypeBinding.BOOLEAN;
}
-/**
- *
- */
@Override
public char[] source() {
return source;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FunctionalExpression.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FunctionalExpression.java
index 5708e444e3..d0ba20d89f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FunctionalExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FunctionalExpression.java
@@ -242,10 +242,10 @@ protected TypeBinding reportSamProblem(BlockScope blockScope, MethodBinding sam)
static class VisibilityInspector extends TypeBindingVisitor {
- private Scope scope;
- private boolean shouldChatter;
+ private final Scope scope;
+ private final boolean shouldChatter;
private boolean visible = true;
- private FunctionalExpression expression;
+ private final FunctionalExpression expression;
public VisibilityInspector(FunctionalExpression expression, Scope scope, boolean shouldChatter) {
this.scope = scope;
@@ -392,4 +392,4 @@ boolean requiresBridges() {
public void cleanUp() {
// to be overridden by sub-classes
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IJavadocTypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IJavadocTypeReference.java
index c21cdaec28..5c22566e59 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IJavadocTypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IJavadocTypeReference.java
@@ -17,7 +17,6 @@
* Interface to allow Javadoc parser to collect both JavaSingleTypeReference and JavaQualifiedTypeReferences
*
* @author jjohnstn
- *
*/
public interface IJavadocTypeReference {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java
index 36d1183428..05cff9baef 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java
@@ -30,7 +30,7 @@ public class IntLiteral extends NumberLiteral {
private static final char[] DECIMAL_MIN_VALUE = "2147483648".toCharArray(); //$NON-NLS-1$
private static final char[] DECIMAL_MAX_VALUE = "2147483647".toCharArray(); //$NON-NLS-1$
- private char[] reducedForm; // no underscores
+ private final char[] reducedForm; // no underscores
public int value;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
index f52a9b7a2b..fef841670f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
@@ -1055,14 +1055,14 @@ private void verifyTypeReference(Expression reference, Expression typeReference,
int scopeModifiers = -1;
// reference must have enough visibility to be used
- if (!canBeSeen(scope.problemReporter().options.reportInvalidJavadocTagsVisibility, modifiers)) {
+ if (!canBeSeen(scope.compilerOptions().reportInvalidJavadocTagsVisibility, modifiers)) {
scope.problemReporter().javadocHiddenReference(typeReference.sourceStart, reference.sourceEnd, scope, modifiers);
return;
}
// type reference must have enough visibility to be used
if (reference != typeReference) {
- if (!canBeSeen(scope.problemReporter().options.reportInvalidJavadocTagsVisibility, resolvedType.modifiers)) {
+ if (!canBeSeen(scope.compilerOptions().reportInvalidJavadocTagsVisibility, resolvedType.modifiers)) {
scope.problemReporter().javadocHiddenReference(typeReference.sourceStart, typeReference.sourceEnd, scope, resolvedType.modifiers);
return;
}
@@ -1206,7 +1206,7 @@ private boolean verifyModuleReference(Expression reference, Expression typeRefer
}
if (!bindingFound) {
- if (!canBeSeen(scope.problemReporter().options.reportInvalidJavadocTagsVisibility, moduleType.modifiers)) {
+ if (!canBeSeen(scope.compilerOptions().reportInvalidJavadocTagsVisibility, moduleType.modifiers)) {
scope.problemReporter().javadocHiddenReference(typeReference.sourceStart, typeReference.sourceEnd, scope, moduleType.modifiers);
return bindingFound;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
index 8466b6dd7a..ae71c8040b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java
@@ -32,7 +32,7 @@ public class JavadocQualifiedTypeReference extends QualifiedTypeReference implem
public int tagSourceStart, tagSourceEnd;
public PackageBinding packageBinding;
public ModuleBinding moduleBinding;
- private boolean canBeModule;
+ private final boolean canBeModule;
public JavadocQualifiedTypeReference(char[][] sources, long[] pos, int tagStart, int tagEnd) {
this(sources, pos, tagStart, tagEnd, false);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java
index a0abd3bf90..f5ca09aeb4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java
@@ -35,7 +35,7 @@ public class JavadocSingleTypeReference extends SingleTypeReference implements I
public int tagSourceStart, tagSourceEnd;
public PackageBinding packageBinding;
public ModuleBinding moduleBinding;
- private boolean canBeModule;
+ private final boolean canBeModule;
public JavadocSingleTypeReference(char[] source, long pos, int tagStart, int tagEnd) {
this(source, pos, tagStart, tagEnd, false);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
index 63dec4e1ce..710be87ff7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
@@ -120,7 +120,7 @@ public class LambdaExpression extends FunctionalExpression implements IPolyExpre
boolean voidCompatible = true;
boolean valueCompatible = false;
boolean returnsValue;
- private boolean requiresGenericSignature;
+ private final boolean requiresGenericSignature;
boolean returnsVoid;
public LambdaExpression original = this;
private boolean committed = false;
@@ -299,6 +299,13 @@ public TypeBinding resolveType(BlockScope blockScope, boolean skipKosherCheck) {
blockScope.enclosingSourceType());
this.binding.typeVariables = Binding.NO_TYPE_VARIABLES;
+ MethodScope enm = this.scope.namedMethodScope();
+ MethodBinding enmb = enm == null ? null : enm.referenceMethodBinding();
+ if (enmb != null && enmb.isViewedAsDeprecated()) {
+ this.binding.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
+ this.binding.tagBits |= enmb.tagBits & TagBits.AnnotationTerminallyDeprecated;
+ }
+
boolean argumentsHaveErrors = false;
if (haveDescriptor) {
int parametersLength = this.descriptor.parameters.length;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java
index f037f02ba9..9f63c72af6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java
@@ -30,7 +30,7 @@ public class LongLiteral extends NumberLiteral {
private static final char[] DECIMAL_MIN_VALUE = "9223372036854775808L".toCharArray(); //$NON-NLS-1$
private static final char[] DECIMAL_MAX_VALUE = "9223372036854775807L".toCharArray(); //$NON-NLS-1$
- private char[] reducedForm; // no underscores
+ private final char[] reducedForm; // no underscores
public static LongLiteral buildLongLiteral(char[] token, int s, int e) {
// remove '_' and prefix '0' first
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleStatement.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleStatement.java
index a53484f630..ba1fbbbf02 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleStatement.java
@@ -7,16 +7,15 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
- *
+ *
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
/**
* Just a marker class to represent statements that can occur in a module declaration
- *
*/
public abstract class ModuleStatement extends ASTNode {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java
index 682637452c..8afda56374 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java
@@ -216,8 +216,6 @@ public static int checkAssignment(BlockScope currentScope, FlowContext flowConte
/**
* Find any mismatches between the two given types, which are caused by null type annotations.
- * @param requiredType
- * @param providedType
* @param nullStatus we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignored
* @return a status object representing the severity of mismatching plus optionally a supertype hint
*/
@@ -226,8 +224,6 @@ public static NullAnnotationMatching analyse(TypeBinding requiredType, TypeBindi
}
/**
* Find any mismatches between the two given types, which are caused by null type annotations.
- * @param requiredType
- * @param providedType
* @param providedSubstitute in inheritance situations this maps the providedType into the realm of the subclass, needed for TVB identity checks.
* Pass null if not interested in these added checks.
* @param substitution TODO
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
index 186a523a66..fd9be2c547 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
@@ -40,11 +40,6 @@ public class ParameterizedQualifiedTypeReference extends ArrayQualifiedTypeRefer
public TypeReference[][] typeArguments;
ReferenceBinding[] typesPerToken;
- /**
- * @param tokens
- * @param dim
- * @param positions
- */
public ParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, int dim, long[] positions) {
super(tokens, dim, positions);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Pattern.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Pattern.java
index edc9e839d4..16744debd1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Pattern.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Pattern.java
@@ -76,7 +76,6 @@ public void setEnclosingPattern(Pattern enclosingPattern) {
/**
* Implement the rules in the spec under 14.11.1.1 Exhaustive Switch Blocks
*
- * @param type
* @return whether pattern covers the given type or not
*/
public boolean coversType(TypeBinding type) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index 3014f1e67f..37ecfbe989 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -696,21 +696,21 @@ public void traverse(ASTVisitor visitor, BlockScope scope) {
}
@Override
protected void reportTypeArgumentRedundancyProblem(ParameterizedTypeBinding allocationType, final BlockScope scope) {
- if (checkDiamondOperatorCanbeRemoved(scope)) {
+ if (diamondOperatorCanbeDeployed(scope)) {
scope.problemReporter().redundantSpecificationOfTypeArguments(this.type, allocationType.arguments);
}
}
- private boolean checkDiamondOperatorCanbeRemoved(final BlockScope scope) {
+ private boolean diamondOperatorCanbeDeployed(final BlockScope scope) {
if (this.anonymousType != null &&
this.anonymousType.methods != null &&
this.anonymousType.methods.length > 0) {
//diamond operator is allowed for anonymous types only from java 9
if (scope.compilerOptions().complianceLevel < ClassFileConstants.JDK9) return false;
for (AbstractMethodDeclaration method : this.anonymousType.methods) {
- if ( method.binding != null && (method.binding.modifiers & ExtraCompilerModifiers.AccOverriding) == 0)
+ if (method.binding != null && !method.binding.isConstructor() && !method.binding.isPrivate() && (method.binding.modifiers & (ExtraCompilerModifiers.AccOverriding | ExtraCompilerModifiers.AccImplementing)) == 0)
return false;
}
}
return true;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
index bf21f48d2d..ebad5c5b47 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
@@ -802,6 +802,7 @@ enclosing instance of this (8.1.3)", we will actually implement this check in co
}
} else {
this.binding = null;
+ this.exactMethodBinding = null;
this.bits &= ~ASTNode.DepthMASK;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
index 5d1409c8a5..7cd9229ec1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -56,7 +56,7 @@ public class ReturnStatement extends Statement {
public SubRoutineStatement[] subroutines;
public LocalVariableBinding saveValueVariable;
public int initStateIndex = -1;
- private boolean implicitReturn;
+ private final boolean implicitReturn;
public ReturnStatement(Expression expression, int sourceStart, int sourceEnd) {
this(expression, sourceStart, sourceEnd, false);
@@ -251,7 +251,6 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
/**
* Dump the suitable return bytecode for a return statement
- *
*/
public void generateReturnBytecode(CodeStream codeStream) {
codeStream.generateReturnBytecode(this.expression);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SubRoutineStatement.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SubRoutineStatement.java
index 04d4b67e4f..044cfa17df 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SubRoutineStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SubRoutineStatement.java
@@ -62,11 +62,6 @@ public void exitDeclaredExceptionHandlers(CodeStream codeStream) {
/**
* Generate an invocation of a subroutine (e.g. jsr finally) in current context.
- * @param currentScope
- * @param codeStream
- * @param targetLocation
- * @param stateIndex
- * @param secretLocal
* @return boolean, true if the generated code will abrupt completion
*/
public abstract boolean generateSubRoutineInvocation(BlockScope currentScope, CodeStream codeStream, Object targetLocation, int stateIndex, LocalVariableBinding secretLocal);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
index 908e939e6c..547dd29f0b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
@@ -76,6 +76,7 @@ public class SwitchStatement extends Expression {
public boolean containsPatterns;
public boolean containsNull;
+ private boolean nullProcessed;
/* package */ BranchLabel switchPatternRestartTarget;
public Pattern totalPattern;
@@ -970,6 +971,7 @@ private void generateCodePatternCaseEpilogue(CodeStream codeStream, int caseInde
Pattern pattern = (Pattern) caseStatement.constantExpressions[caseStatement.patternIndex];
pattern.elseTarget.place();
pattern.suspendVariables(codeStream, this.scope);
+ caseIndex = this.nullProcessed ? caseIndex - 1 : caseIndex;
if (!pattern.isAlwaysTrue()) {
codeStream.loadInt(caseIndex);
codeStream.store(this.restartIndexLocal, false);
@@ -977,6 +979,8 @@ private void generateCodePatternCaseEpilogue(CodeStream codeStream, int caseInde
}
pattern.thenTarget.place();
pattern.resumeVariables(codeStream, this.scope);
+ } else if (this.containsNull && caseStatement != null) {
+ this.nullProcessed |= caseStatement.patternIndex == -1;
}
}
private void generateCodeSwitchPatternPrologue(BlockScope currentScope, CodeStream codeStream) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java
index 0cde48c265..86c395fae9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java
@@ -21,9 +21,9 @@
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class TrueLiteral extends MagicLiteral {
-
+
static final char[] source = {'t' , 'r' , 'u' , 'e'};
-
+
public TrueLiteral(int s , int e) {
super(s,e);
}
@@ -67,9 +67,6 @@ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStr
public TypeBinding literalType(BlockScope scope) {
return TypeBinding.BOOLEAN;
}
-/**
- *
- */
@Override
public char[] source() {
return source;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TryStatement.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
index 6aab623916..7d63d179c9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TryStatement.java
@@ -598,7 +598,9 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
if (resourceCount > 0) {
for (int i = resourceCount; i >= 0; i--) {
BranchLabel exitLabel = new BranchLabel(codeStream);
- this.resourceExceptionLabels[i].placeEnd(); // outer handler if any is the one that should catch exceptions out of close()
+ if (this.resourceExceptionLabels[i].getCount() % 2 != 0) {
+ this.resourceExceptionLabels[i].placeEnd(); // outer handler if any is the one that should catch exceptions out of close()
+ }
Statement stmt = i > 0 ? this.resources[i - 1] : null;
if ((this.bits & ASTNode.IsTryBlockExiting) == 0) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index ddf5812293..275d3e98a5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -238,7 +238,6 @@ public MethodDeclaration addMissingAbstractMethodFor(MethodBinding methodBinding
/**
* Flow analysis for a local innertype
- *
*/
@Override
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
@@ -261,7 +260,6 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
/**
* Flow analysis for a member innertype
- *
*/
public void analyseCode(ClassScope enclosingClassScope) {
if (this.ignoreFurtherInvestigation)
@@ -277,7 +275,6 @@ public void analyseCode(ClassScope enclosingClassScope) {
/**
* Flow analysis for a local member innertype
- *
*/
public void analyseCode(ClassScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
if (this.ignoreFurtherInvestigation)
@@ -298,7 +295,6 @@ public void analyseCode(ClassScope currentScope, FlowContext flowContext, FlowIn
/**
* Flow analysis for a package member type
- *
*/
public void analyseCode(CompilationUnitScope unitScope) {
if (this.ignoreFurtherInvestigation)
@@ -1518,14 +1514,15 @@ public void resolve() {
} else if (!sourceType.isLocalType()) {
// Set javadoc visibility
int visibility = sourceType.modifiers & ExtraCompilerModifiers.AccVisibilityMASK;
- ProblemReporter reporter = this.scope.problemReporter();
- int severity = reporter.computeSeverity(IProblem.JavadocMissing);
- if (severity != ProblemSeverities.Ignore) {
- if (this.enclosingType != null) {
- visibility = Util.computeOuterMostVisibility(this.enclosingType, visibility);
+ try (ProblemReporter reporter = this.scope.problemReporter()) {
+ int severity = reporter.computeSeverity(IProblem.JavadocMissing);
+ if (severity != ProblemSeverities.Ignore) {
+ if (this.enclosingType != null) {
+ visibility = Util.computeOuterMostVisibility(this.enclosingType, visibility);
+ }
+ int javadocModifiers = (this.binding.modifiers & ~ExtraCompilerModifiers.AccVisibilityMASK) | visibility;
+ reporter.javadocMissing(this.sourceStart, this.sourceEnd, severity, javadocModifiers);
}
- int javadocModifiers = (this.binding.modifiers & ~ExtraCompilerModifiers.AccVisibilityMASK) | visibility;
- reporter.javadocMissing(this.sourceStart, this.sourceEnd, severity, javadocModifiers);
}
}
updateNestHost();
@@ -1647,7 +1644,6 @@ public void tagAsHavingIgnoredMandatoryErrors(int problemId) {
/**
* Iteration for a package member type
- *
*/
public void traverse(ASTVisitor visitor, CompilationUnitScope unitScope) {
try {
@@ -1779,7 +1775,6 @@ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
/**
* Iteration for a member innertype
- *
*/
public void traverse(ASTVisitor visitor, ClassScope classScope) {
try {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
index 5e055c869c..0021063a5b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
@@ -430,9 +430,6 @@ public AnnotationContext[] getAllAnnotationContexts(int targetType) {
}
/**
* info can be either a type index (superclass/superinterfaces) or a pc into the bytecode
- * @param targetType
- * @param info
- * @param allAnnotationContexts
*/
public void getAllAnnotationContexts(int targetType, int info, List allAnnotationContexts) {
AnnotationCollector collector = new AnnotationCollector(this, targetType, info, allAnnotationContexts);
@@ -485,7 +482,6 @@ public Annotation[][] getAnnotationsOnDimensions() {
* view since extended dimensions bind more readily than type components that precede the identifier. This is how it ought
* to be encoded in bindings and how it ought to be persisted in class files. However for DOM/AST construction, we need the
* dimensions in source order, so we provide a way for the clients to ask what they want.
- *
*/
public Annotation[][] getAnnotationsOnDimensions(boolean useSourceOrder) {
return null;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnlikelyArgumentCheck.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnlikelyArgumentCheck.java
index f8ba8be906..84bb630bf0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnlikelyArgumentCheck.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnlikelyArgumentCheck.java
@@ -39,7 +39,6 @@ private UnlikelyArgumentCheck(DangerousMethod dangerousMethod, TypeBinding typeT
/**
* Check if the invocation is likely a bug.
- * @param currentScope
* @return false, if the typeToCheck does not seem to related to the expectedType
*/
public boolean isDangerous(BlockScope currentScope) {
@@ -133,7 +132,7 @@ public boolean isDangerous(BlockScope currentScope) {
ReferenceBinding argumentCollectionType = argumentType
.findSuperTypeOriginatingFrom(TypeIds.T_JavaUtilCollection, false);
if (collectionType != null && argumentCollectionType != null
- && argumentCollectionType.isParameterizedTypeWithActualArguments()
+ && argumentCollectionType.isParameterizedTypeWithActualArguments()
&& collectionType.isParameterizedTypeWithActualArguments()) {
return new UnlikelyArgumentCheck(suspect,
((ParameterizedTypeBinding) argumentCollectionType).typeArguments()[0],
@@ -187,4 +186,4 @@ public boolean isDangerous(BlockScope currentScope) {
}
return null;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BasicModule.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BasicModule.java
index 2f027f835a..0cd3f56874 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BasicModule.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BasicModule.java
@@ -102,7 +102,7 @@ private static PackageExportImpl createPackageOpen(OpensStatement ref) {
char[][] uses;
Service[] provides;
IModule.IPackageExport[] opens;
- private ICompilationUnit compilationUnit;
+ private final ICompilationUnit compilationUnit;
public BasicModule(ModuleDeclaration descriptor, IModulePathEntry root) {
this.compilationUnit = descriptor.compilationResult().compilationUnit;
@@ -249,4 +249,4 @@ protected void toStringContent(StringBuffer buffer) {
}
buffer.append('\n').append('}').toString();
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BatchCompilerRequestor.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BatchCompilerRequestor.java
index 63530f38bd..1346de8e12 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BatchCompilerRequestor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/BatchCompilerRequestor.java
@@ -18,7 +18,7 @@
public class BatchCompilerRequestor implements ICompilerRequestor {
- private Main compiler;
+ private final Main compiler;
private int lineDelta = 0;
public BatchCompilerRequestor(Main compiler) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java
index b59f9fc4bf..6beddc7207 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java
@@ -57,9 +57,9 @@
public class ClasspathDirectory extends ClasspathLocation {
private Hashtable directoryCache;
-private String[] missingPackageHolder = new String[1];
-private int mode; // ability to only consider one kind of files (source vs. binaries), by default use both
-private String encoding; // only useful if referenced in the source path
+private final String[] missingPackageHolder = new String[1];
+private final int mode; // ability to only consider one kind of files (source vs. binaries), by default use both
+private final String encoding; // only useful if referenced in the source path
private Hashtable> packageSecondaryTypes = null;
Map options;
@@ -80,6 +80,9 @@ public class ClasspathDirectory extends ClasspathLocation {
this.encoding = encoding;
}
String[] directoryList(String qualifiedPackageName) {
+ if (File.separatorChar != '/' && qualifiedPackageName.indexOf('/') != -1) {
+ qualifiedPackageName = qualifiedPackageName.replace('/', File.separatorChar);
+ }
String[] dirList = (String[]) this.directoryCache.get(qualifiedPackageName);
if (dirList == this.missingPackageHolder) return null; // package exists in another classpath directory or jar
if (dirList != null) return dirList;
@@ -146,7 +149,7 @@ private NameEnvironmentAnswer findClassInternal(char[] typeName, String qualifie
try {
ClassFileReader reader = ClassFileReader.read(this.path + qualifiedBinaryFileName);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115, package names are to be treated case sensitive.
- String typeSearched = qualifiedPackageName.length() > 0 ?
+ String typeSearched = qualifiedPackageName.length() > 0 ?
qualifiedPackageName.replace(File.separatorChar, '/') + "/" + fileName //$NON-NLS-1$
: fileName;
if (!CharOperation.equals(reader.getName(), typeSearched.toCharArray())) {
@@ -205,8 +208,8 @@ private Hashtable getSecondaryTypes(String qualifiedPackageName)
Hashtable packageEntry = new Hashtable<>();
String[] dirList = (String[]) this.directoryCache.get(qualifiedPackageName);
- if (dirList == this.missingPackageHolder // package exists in another classpath directory or jar
- || dirList == null)
+ if (dirList == this.missingPackageHolder // package exists in another classpath directory or jar
+ || dirList == null)
return packageEntry;
File dir = new File(this.path + qualifiedPackageName);
@@ -221,7 +224,7 @@ private Hashtable getSecondaryTypes(String qualifiedPackageName)
if (!(s.endsWith(SUFFIX_STRING_java) || s.endsWith(SUFFIX_STRING_JAVA))) continue;
CompilationUnit cu = new CompilationUnit(null, s, this.encoding, this.destinationPath);
CompilationResult compilationResult = new CompilationResult(s.toCharArray(), 1, 1, 10);
- ProblemReporter problemReporter =
+ ProblemReporter problemReporter =
new ProblemReporter(
DefaultErrorHandlingPolicies.proceedWithAllProblems(),
new CompilerOptions(this.options),
@@ -235,14 +238,14 @@ private Hashtable getSecondaryTypes(String qualifiedPackageName)
for (int j = 0, k = types.length; j < k; j++) {
TypeDeclaration type = types[j];
char[] name = type.isSecondary() ? type.name : null; // add only secondary types
- if (name != null)
+ if (name != null)
packageEntry.put(new String(name), s);
}
}
return packageEntry;
}
private NameEnvironmentAnswer findSourceSecondaryType(String typeName, String qualifiedPackageName, String qualifiedBinaryFileName) {
-
+
if (this.packageSecondaryTypes == null) this.packageSecondaryTypes = new Hashtable<>();
Hashtable packageEntry = this.packageSecondaryTypes.get(qualifiedPackageName);
if (packageEntry == null) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJsr199.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJsr199.java
index 725dce6a84..9366e7dbf2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJsr199.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJsr199.java
@@ -44,8 +44,8 @@ public class ClasspathJsr199 extends ClasspathLocation {
fileTypes.add(JavaFileObject.Kind.CLASS);
}
- private JavaFileManager fileManager;
- private JavaFileManager.Location location;
+ private final JavaFileManager fileManager;
+ private final JavaFileManager.Location location;
private Classpath jrt;
public ClasspathJsr199(JavaFileManager file, JavaFileManager.Location location) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java
index d906d7bb4b..8ff0c8e8b6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java
@@ -23,7 +23,7 @@
import org.eclipse.jdt.internal.compiler.util.Util;
public class ClasspathSourceJar extends ClasspathJar {
- private String encoding;
+ private final String encoding;
public ClasspathSourceJar(File file, boolean closeZipFileAtEnd,
AccessRuleSet accessRuleSet, String encoding,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java
index aa9c1d100e..3a9c945f4b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java
@@ -38,13 +38,13 @@ public class CompilationUnit implements ICompilationUnit {
// == Main.NONE: absorbent element, do not output class files;
// else: use as the path of the directory into which class files must
// be written.
- private boolean ignoreOptionalProblems;
+ private final boolean ignoreOptionalProblems;
private ModuleBinding moduleBinding;
/**
* annotation path can only be retrieved once the qualified type name is known.
* This is the provided function for computing the annotation path from that type name.
*/
- private Function annotationPathProvider;
+ private final Function annotationPathProvider;
public CompilationUnit(char[] contents, String fileName, String encoding) {
this(contents, fileName, encoding, null);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
index a706fb8288..9e6acd33b0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java
@@ -120,8 +120,6 @@ default boolean hasCUDeclaringPackage(String qualifiedPackageName, Function options, String release) {
Classpath result = null;
File file = new File(convertPathSeparators(classpathName));
- if (file.isDirectory() || classpathName.endsWith("-classes")) {//$NON-NLS-1$
+ if (file.isDirectory() || classpathName.endsWith("-classes")) { //$NON-NLS-1$
if (file.exists()) {
result = new ClasspathDirectory(file, encoding,
isSourceOnly ? ClasspathLocation.SOURCE :
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java
index 5e3f834922..bf50534e58 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -123,10 +123,10 @@
public class Main implements ProblemSeverities, SuffixConstants {
public static class Logger {
- private PrintWriter err;
+ private final PrintWriter err;
private PrintWriter log;
- private Main main;
- private PrintWriter out;
+ private final Main main;
+ private final PrintWriter out;
int tagBits;
private static final String CLASS = "class"; //$NON-NLS-1$
private static final String CLASS_FILE = "classfile"; //$NON-NLS-1$
@@ -254,9 +254,6 @@ public void close() {
}
}
- /**
- *
- */
public void compiling() {
printlnOut(this.main.bind("progress.compiling")); //$NON-NLS-1$
}
@@ -719,9 +716,6 @@ public void logIncorrectVMVersionForAnnotationProcessing() {
this.printlnErr(this.main.bind("configure.incorrectVMVersionforAPT")); //$NON-NLS-1$
}
- /**
- *
- */
public void logNoClassFileCreated(String outputDir, String relativeFileName, IOException e) {
if ((this.tagBits & Logger.XML) != 0) {
HashMap parameters = new HashMap<>();
@@ -741,9 +735,6 @@ public void logNoClassFileCreated(String outputDir, String relativeFileName, IOE
}));
}
- /**
- * @param exportedClassFilesCounter
- */
public void logNumberOfClassFilesGenerated(int exportedClassFilesCounter) {
if ((this.tagBits & Logger.XML) != 0) {
HashMap parameters = new HashMap<>();
@@ -910,11 +901,6 @@ public int logProblems(CategorizedProblem[] problems, char[] unitSource, Main cu
return localErrorCount;
}
- /**
- * @param globalProblemsCount
- * @param globalErrorsCount
- * @param globalWarningsCount
- */
public void logProblemsSummary(int globalProblemsCount,
int globalErrorsCount, int globalWarningsCount, int globalInfoCount, int globalTasksCount) {
if ((this.tagBits & Logger.XML) != 0) {
@@ -1003,9 +989,6 @@ public void logProblemsSummary(int globalProblemsCount,
}
}
- /**
- *
- */
public void logProgress() {
printOut('.');
}
@@ -1020,9 +1003,6 @@ public void logRepetition(int i, int repetitions) {
printlnOut(this.main.bind("compile.repetition", //$NON-NLS-1$
String.valueOf(i + 1), String.valueOf(repetitions)));
}
- /**
- * @param compilerStats
- */
public void logTiming(CompilerStats compilerStats) {
long time = compilerStats.elapsedTime();
long lineCount = compilerStats.lineCount;
@@ -1066,7 +1046,6 @@ public void logTiming(CompilerStats compilerStats) {
/**
* Print the usage of the compiler
- * @param usage
*/
public void logUsage(String usage) {
printlnOut(usage);
@@ -1222,9 +1201,6 @@ private void printlnOut(String s) {
}
}
- /**
- *
- */
public void printNewLine() {
this.out.println();
}
@@ -5683,4 +5659,4 @@ protected void validateOptions(boolean didSpecifyCompliance) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
index fb61cdcb3e..7b14c70dfe 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java
@@ -154,7 +154,6 @@ private static String getFileName(File file) {
* element, first being the source module and second being the target module.
* The expected format is:
* --add-reads =
- * @param option
* @return a String[] with source and target module of the "reads" clause.
*/
protected static String[] extractAddonRead(String option) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
index 9c85ef424c..cad63a5b49 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
@@ -44,7 +44,6 @@ public class AnnotationInfo extends ClassFileStruct implements IBinaryAnnotation
super(classFileBytes, contantPoolOffsets, offset);
}
/**
- * @param classFileBytes
* @param offset the offset into classFileBytes for the "type_index" of the annotation attribute.
* @param populate true to indicate to build out the annotation structure.
*/
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithAnnotations.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithAnnotations.java
index 0d9c00d30e..519f31fda8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithAnnotations.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithAnnotations.java
@@ -16,7 +16,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
public class AnnotationMethodInfoWithAnnotations extends AnnotationMethodInfo {
- private AnnotationInfo[] annotations;
+ private final AnnotationInfo[] annotations;
AnnotationMethodInfoWithAnnotations(MethodInfo methodInfo, Object defaultValue, AnnotationInfo[] annotations) {
super(methodInfo, defaultValue);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithTypeAnnotations.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithTypeAnnotations.java
index 1479ceacd9..70baa3afcc 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithTypeAnnotations.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithTypeAnnotations.java
@@ -16,7 +16,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
class AnnotationMethodInfoWithTypeAnnotations extends AnnotationMethodInfoWithAnnotations {
- private TypeAnnotationInfo[] typeAnnotations;
+ private final TypeAnnotationInfo[] typeAnnotations;
AnnotationMethodInfoWithTypeAnnotations(MethodInfo methodInfo, Object defaultValue, AnnotationInfo[] annotations, TypeAnnotationInfo[] typeAnnotations) {
super(methodInfo, defaultValue, annotations);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
index 202d763003..0af97034f8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java
@@ -53,7 +53,7 @@
public class ClassFileReader extends ClassFileStruct implements IBinaryType {
private int accessFlags;
- private char[] classFileName;
+ private final char[] classFileName;
private char[] className;
private int classNameIndex;
private int constantPoolCount;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java
index 0ca00b6d14..43a91357d0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java
@@ -13,7 +13,7 @@
package org.eclipse.jdt.internal.compiler.classfmt;
public class ComponentInfoWithAnnotation extends RecordComponentInfo {
- private AnnotationInfo[] annotations;
+ private final AnnotationInfo[] annotations;
ComponentInfoWithAnnotation(RecordComponentInfo info, AnnotationInfo[] annos) {
super(info.reference, info.constantPoolOffsets, info.structOffset, info.version);
@@ -57,4 +57,4 @@ public String toString() {
toStringContent(buffer);
return buffer.toString();
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java
index 18b5b22f73..290c5bb6ae 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java
@@ -15,7 +15,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
public final class ComponentInfoWithTypeAnnotation extends ComponentInfoWithAnnotation {
- private TypeAnnotationInfo[] typeAnnotations;
+ private final TypeAnnotationInfo[] typeAnnotations;
ComponentInfoWithTypeAnnotation(RecordComponentInfo info, AnnotationInfo[] annos, TypeAnnotationInfo[] typeAnnos) {
super(info, annos);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java
index 510a410746..b064be60f7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java
@@ -22,8 +22,8 @@ public class ElementValuePairInfo implements org.eclipse.jdt.internal.compiler.e
static final ElementValuePairInfo[] NoMembers = new ElementValuePairInfo[0];
- private char[] name;
- private Object value;
+ private final char[] name;
+ private final Object value;
public ElementValuePairInfo(char[] name, Object value) {
this.name = name;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java
index 11cda3212d..a3ab58a4f3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java
@@ -39,7 +39,7 @@
* result of {@link #enrichWithExternalAnnotationsFor} or {@link #getExternalAnnotationStatus}.
*/
public class ExternalAnnotationDecorator implements IBinaryType {
- private IBinaryType inputType;
+ private final IBinaryType inputType;
private ExternalAnnotationProvider annotationProvider;
private boolean isFromSource;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java
index 330d35f9db..e2fcc659da 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java
@@ -335,7 +335,7 @@ void initAnnotations(final LookupEnvironment environment) {
*/
class DispatchingAnnotationWalker implements ITypeAnnotationWalker {
- private LookupEnvironment environment;
+ private final LookupEnvironment environment;
private TypeParametersAnnotationWalker typeParametersWalker;
public DispatchingAnnotationWalker(LookupEnvironment environment) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithAnnotation.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithAnnotation.java
index dd03e65f59..0875834ae0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithAnnotation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithAnnotation.java
@@ -16,7 +16,7 @@
package org.eclipse.jdt.internal.compiler.classfmt;
public class FieldInfoWithAnnotation extends FieldInfo {
- private AnnotationInfo[] annotations;
+ private final AnnotationInfo[] annotations;
FieldInfoWithAnnotation(FieldInfo info, AnnotationInfo[] annos) {
super(info.reference, info.constantPoolOffsets, info.structOffset, info.version);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithTypeAnnotation.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithTypeAnnotation.java
index 00f8055a85..a3927cbadc 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithTypeAnnotation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithTypeAnnotation.java
@@ -17,7 +17,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
public final class FieldInfoWithTypeAnnotation extends FieldInfoWithAnnotation {
- private TypeAnnotationInfo[] typeAnnotations;
+ private final TypeAnnotationInfo[] typeAnnotations;
FieldInfoWithTypeAnnotation(FieldInfo info, AnnotationInfo[] annos, TypeAnnotationInfo[] typeAnnos) {
super(info, annos);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
index 7a2a0ca30f..79bce007ad 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
@@ -18,7 +18,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation;
class MethodInfoWithParameterAnnotations extends MethodInfoWithAnnotations {
- private AnnotationInfo[][] parameterAnnotations;
+ private final AnnotationInfo[][] parameterAnnotations;
MethodInfoWithParameterAnnotations(MethodInfo methodInfo, AnnotationInfo[] annotations, AnnotationInfo[][] parameterAnnotations) {
super(methodInfo, annotations);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithTypeAnnotations.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithTypeAnnotations.java
index 010e0e75fb..d86137f9d5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithTypeAnnotations.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithTypeAnnotations.java
@@ -17,7 +17,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation;
class MethodInfoWithTypeAnnotations extends MethodInfoWithParameterAnnotations {
- private TypeAnnotationInfo[] typeAnnotations;
+ private final TypeAnnotationInfo[] typeAnnotations;
MethodInfoWithTypeAnnotations(MethodInfo methodInfo, AnnotationInfo[] annotations, AnnotationInfo[][] parameterAnnotations, TypeAnnotationInfo[] typeAnnotations) {
super(methodInfo, annotations, parameterAnnotations);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
index 0e34fc7a04..8fb2025617 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
@@ -3759,10 +3759,6 @@ final public byte[] getContents() {
/**
* Returns the type that should be substituted to original binding declaring class as the proper receiver type
- * @param currentScope
- * @param codegenBinding
- * @param actualReceiverType
- * @param isImplicitThisReceiver
* @return the receiver type to use in constant pool
*/
public static TypeBinding getConstantPoolDeclaringClass(Scope currentScope, FieldBinding codegenBinding, TypeBinding actualReceiverType, boolean isImplicitThisReceiver) {
@@ -3789,10 +3785,6 @@ public static TypeBinding getConstantPoolDeclaringClass(Scope currentScope, Fiel
/**
* Returns the type that should be substituted to original binding declaring class as the proper receiver type
- * @param currentScope
- * @param codegenBinding
- * @param actualReceiverType
- * @param isImplicitThisReceiver
* @return the receiver type to use in constant pool
*/
public static TypeBinding getConstantPoolDeclaringClass(Scope currentScope, MethodBinding codegenBinding, TypeBinding actualReceiverType, boolean isImplicitThisReceiver) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
index 3e44c49bf1..9b9c691686 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
@@ -36,7 +36,7 @@
@SuppressWarnings({ "rawtypes", "unchecked" })
public class StackMapFrameCodeStream extends CodeStream {
public static class ExceptionMarker implements Comparable {
- private TypeBinding binding;
+ private final TypeBinding binding;
public int pc;
public ExceptionMarker(int pc, TypeBinding typeBinding) {
@@ -213,7 +213,7 @@ public void generateClassLiteralAccessForType(Scope scope, TypeBinding accessedT
/*
* Macro for building a class descriptor object... using or not a field cache to store it into... this
* sequence is responsible for building the actual class descriptor.
- *
+ *
* If the fieldCache is set, then it is supposed to be the body of a synthetic access method factoring the
* actual descriptor creation out of the invocation site (saving space). If the fieldCache is nil, then we
* are dumping the bytecode on the invocation site, since we have no way to get a hand on the field cache to
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRestriction.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRestriction.java
index 405bf6bdd0..3e920078f5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRestriction.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRestriction.java
@@ -15,7 +15,7 @@
public class AccessRestriction {
- private AccessRule accessRule;
+ private final AccessRule accessRule;
public byte classpathEntryType;
public static final byte
COMMAND_LINE = 0,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRuleSet.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRuleSet.java
index 74a7589948..6d76210f84 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRuleSet.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/AccessRuleSet.java
@@ -21,7 +21,7 @@
*/
public class AccessRuleSet {
- private AccessRule[] accessRules;
+ private final AccessRule[] accessRules;
public byte classpathEntryType; // one of AccessRestriction#COMMAND_LINE, LIBRARY, PROJECT
public String classpathEntryName;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModuleAwareNameEnvironment.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModuleAwareNameEnvironment.java
index 539caaba7c..07e086d8d4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModuleAwareNameEnvironment.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModuleAwareNameEnvironment.java
@@ -72,7 +72,7 @@ public boolean matchesWithName(T elem, Predicate isNamed, Predicate na
public boolean matches(T elem, Predicate isNamed) {
return matchesWithName(elem, isNamed, t -> true);
}
-
+
/** Get the lookup strategy corresponding to the given module name. */
public static LookupStrategy get(char[] moduleName) {
if (moduleName == ModuleBinding.ANY)
@@ -91,7 +91,7 @@ public static String getStringName(char[] moduleName) {
}
}
}
-
+
@Override
default NameEnvironmentAnswer findType(char[][] compoundTypeName) {
return findType(compoundTypeName, ModuleBinding.ANY);
@@ -121,15 +121,14 @@ default char[][] getUniqueModulesDeclaringPackage(char[][] packageName, char[] m
return allNames;
}
-
+
/**
* Answer whether the given package (within the given module) contains any compilation unit.
- * @param qualifiedPackageName
* @param checkCUs - if true, check contained Compilation Units for a matching package declaration
* @return true iff the package contains at least one compilation unit.
*/
boolean hasCompilationUnit(char[][] qualifiedPackageName, char[] moduleName, boolean checkCUs);
-
+
/** Get the module with the given name, which must denote a named module. */
IModule getModule(char[] moduleName);
char[][] getAllAutomaticModules();
@@ -142,9 +141,8 @@ default char[][] getUniqueModulesDeclaringPackage(char[][] packageName, char[] m
default void applyModuleUpdates(IUpdatableModule module, IUpdatableModule.UpdateKind kind) { /* default: do nothing */ }
/**
- * Lists all packages in the module identified by the given, real module name
+ * Lists all packages in the module identified by the given, real module name
* (i.e., this method is implemented only for {@link LookupStrategy#Named}).
- * @param moduleName
* @return array of flat, dot-separated package names
*/
char[][] listPackages(char[] moduleName);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModulePathEntry.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModulePathEntry.java
index 86f24f73a0..bf68451a28 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModulePathEntry.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IModulePathEntry.java
@@ -18,25 +18,24 @@
/**
* Represents an entry on the module path of a project. Could be a single module or a collection of
* modules (like a jimage or an exploded module directory structure)
- *
*/
public interface IModulePathEntry {
/**
* Get the module that this entry contributes. May be null, for instance when this entry does not
* represent a single module
- *
+ *
* @return The module that this entry contributes or null
*/
default IModule getModule() {
return null;
}
-
+
/**
* Get the module named name from this entry. May be null
- *
+ *
* @param name - The name of the module to look up
- *
+ *
* @return The module named name or null
*/
default IModule getModule(char[] name) {
@@ -48,9 +47,9 @@ default IModule getModule(char[] name) {
/**
* Indicates whether this entry knows the module named name and can answer queries regarding the module
- *
+ *
* @param name The name of the module
- *
+ *
* @return True if this entry knows the module, false otherwise
*/
default boolean servesModule(char[] name) {
@@ -84,10 +83,10 @@ default char[][] listPackages() {
/**
* Specifies whether this entry represents an automatic module.
- *
+ *
* @return true if this is an automatic module, false otherwise
*/
public default boolean isAutomaticModule() {
return false;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IMultiModuleEntry.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IMultiModuleEntry.java
index 1d48ff9405..176acc5f0b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IMultiModuleEntry.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/IMultiModuleEntry.java
@@ -18,12 +18,11 @@
/**
* Represents a module path entry that represents a collection of modules
* like a jimage or an exploded module directory structure
- *
*/
public interface IMultiModuleEntry extends IModulePathEntry {
/**
- * Get the module named name that this entry contributes to the module path
+ * Get the module named name that this entry contributes to the module path
*/
@Override
@@ -36,4 +35,4 @@ public interface IMultiModuleEntry extends IModulePathEntry {
*/
Collection getModuleNames(Collection limitModules);
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java
index 5fd197078c..fd678bb4bf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -18,10 +18,9 @@
* can use to look up types, compilation units, and packages in the
* current environment. The name environment is passed to the compiler
* on creation.
- *
+ *
* This name environment adds a method to switch on/off the search for secondary types.
* Refer {@link #findType(char[], char[][], boolean)}.
- *
*/
public interface INameEnvironmentExtension extends INameEnvironment {
/**
@@ -48,7 +47,7 @@ public interface INameEnvironmentExtension extends INameEnvironment {
* @return {@link NameEnvironmentAnswer}
*/
NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes, char[] moduleName);
-
+
default NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes) {
return findType(typeName, packageName, searchWithSecondaryTypes, null);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/ITypeAnnotationWalker.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/ITypeAnnotationWalker.java
index cc846adcc2..c7a608fa84 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/ITypeAnnotationWalker.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/env/ITypeAnnotationWalker.java
@@ -18,7 +18,7 @@
* A TypeAnnotationWalker is initialized with all type annotations found at a given element.
* It can be used to walk into the types at the given element and finally answer the
* actual annotations at any node of the walk.
- *
+ *
* The walker is implemented as immutable objects. During the walk either new instances
* are created, or the current instance is shared if no difference is encountered.
*/
@@ -90,13 +90,12 @@ public interface ITypeAnnotationWalker {
/**
* Detail of {@link #toTypeParameterBounds(boolean, int)}: walk to the bounds
- * of the previously selected type parameter.
- * @param boundIndex
+ * of the previously selected type parameter.
*/
public abstract ITypeAnnotationWalker toTypeBound(short boundIndex);
/** Walk to the specified supertype either index based or name based:
- * @param index -1 is superclass, else index into the list of superinterfaces
+ * @param index -1 is superclass, else index into the list of superinterfaces
* @param superTypeSignature name and type arguments of the super type to visit
*/
public abstract ITypeAnnotationWalker toSupertype(short index, char[] superTypeSignature);
@@ -133,4 +132,4 @@ public interface ITypeAnnotationWalker {
*/
public abstract IBinaryAnnotation[] getAnnotationsAtCursor(int currentTypeId, boolean mayApplyArrayContentsDefaultNullness);
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java
index 256bb09b7a..dd6d8a82e0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java
@@ -22,7 +22,6 @@
/**
* Record conditional initialization status during definite assignment analysis
- *
*/
public class ConditionalFlowInfo extends FlowInfo {
@@ -121,7 +120,7 @@ public boolean isDefinitelyUnknown(LocalVariableBinding local) {
@Override
public boolean hasNullInfoFor(LocalVariableBinding local) {
- return this.initsWhenTrue.hasNullInfoFor(local)
+ return this.initsWhenTrue.hasNullInfoFor(local)
|| this.initsWhenFalse.hasNullInfoFor(local);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java
index d6489465e9..841a96fe6d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java
@@ -65,7 +65,7 @@ public class ExceptionHandlingFlowContext extends FlowContext {
private static final Argument[] NO_ARGUMENTS = new Argument[0];
public Argument [] catchArguments;
- private int[] exceptionToCatchBlockMap;
+ private final int[] exceptionToCatchBlockMap;
public ExceptionHandlingFlowContext(
FlowContext parent,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
index e45954b760..3c871619f8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
@@ -10,7 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Stephan Herrmann - Contributions for
+ * Stephan Herrmann - Contributions for
* bug 292478 - Report potentially null across variable assignment
* bug 332637 - Dead Code detection removing code that isn't dead
* bug 394768 - [compiler][resource] Incorrect resource leak warning when creating stream in conditional
@@ -29,9 +29,9 @@ public abstract class FlowInfo {
public int tagBits; // REACHABLE by default
public final static int REACHABLE = 0;
- /* unreachable code
+ /* unreachable code
* eg. while (true);
- * i++; --> unreachable code
+ * i++; --> unreachable code
*/
public final static int UNREACHABLE_OR_DEAD = 1;
/* unreachable code as inferred by null analysis
@@ -46,7 +46,7 @@ public abstract class FlowInfo {
*/
public final static int UNREACHABLE = UNREACHABLE_OR_DEAD | UNREACHABLE_BY_NULLANALYSIS;
public final static int NULL_FLAG_MASK = 4;
-
+
public final static int UNKNOWN = 1;
public final static int NULL = 2;
public final static int NON_NULL = 4;
@@ -55,7 +55,7 @@ public abstract class FlowInfo {
public final static int POTENTIALLY_NON_NULL = 32;
public final static int UNROOTED = 64; // marks a flowInfo that may be appended to another flowInfo (accepting incoming nulls/nonnulls, see UFI.iNBit/iNNBit).
-
+
public static final int FREE_TYPEVARIABLE = FlowInfo.POTENTIALLY_NULL | FlowInfo.POTENTIALLY_NON_NULL;
public static final UnconditionalFlowInfo DEAD_END; // Represents a dead branch status of initialization
@@ -324,7 +324,6 @@ public static UnconditionalFlowInfo initial(int maxFieldCount) {
/**
* Mark the null status of the given local according to the given status
- * @param local
* @param nullStatus bitset of FLowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL
*/
public void markNullStatus(LocalVariableBinding local, int nullStatus) {
@@ -355,7 +354,6 @@ public void markNullStatus(LocalVariableBinding local, int nullStatus) {
/**
* Answer the null status of the given local
- * @param local
* @return bitset of FlowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL
*/
public int nullStatus(LocalVariableBinding local) {
@@ -542,7 +540,7 @@ else if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0 &&
// if a variable is only initialized in one branch and not initialized in the other,
// then we need to cast a doubt on its initialization in the merged info
mergedInfo.mergeDefiniteInitsWith(initsWhenFalse.unconditionalCopy());
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=415997, classify unreachability precisely, IsElseStatementUnreachable could be due to null analysis
if ((mergedInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0 && (initsWhenFalse.tagBits & FlowInfo.UNREACHABLE) == FlowInfo.UNREACHABLE_BY_NULLANALYSIS) {
mergedInfo.tagBits &= ~UNREACHABLE_OR_DEAD;
@@ -556,7 +554,7 @@ else if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0 &&
// true or false (i.e if(true), etc) for sure
// We don't do this if both if and else branches themselves are in an unreachable code
// or if any of them is a DEAD_END (e.g. contains 'return' or 'throws')
- mergedInfo =
+ mergedInfo =
initsWhenFalse.addPotentialInitializationsFrom(initsWhenTrue.
nullInfoLessUnconditionalCopy()).
unconditionalInits();
@@ -674,7 +672,6 @@ public String toString(){
/**
* Resets the definite and potential initialization info for the given local variable
- * @param local
*/
abstract public void resetAssignmentInfo(LocalVariableBinding local);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java
index d98fadcc61..d7236cfa39 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java
@@ -59,7 +59,7 @@ public class LoopingFlowContext extends SwitchFlowContext {
public BranchLabel continueLabel;
public UnconditionalFlowInfo initsOnContinue = FlowInfo.DEAD_END;
- private UnconditionalFlowInfo upstreamNullFlowInfo;
+ private final UnconditionalFlowInfo upstreamNullFlowInfo;
private LoopingFlowContext innerFlowContexts[] = null;
private UnconditionalFlowInfo innerFlowInfos[] = null;
private int innerFlowContextsCount = 0;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java
index 6f560e34e2..ff18abec9a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java
@@ -15,7 +15,7 @@
public class BooleanConstant extends Constant {
- private boolean value;
+ private final boolean value;
private static final BooleanConstant TRUE = new BooleanConstant(true);
private static final BooleanConstant FALSE = new BooleanConstant(false);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java
index 91ffe68ae9..82cb38053a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java
@@ -15,7 +15,7 @@
public class ByteConstant extends Constant {
- private byte value;
+ private final byte value;
public static Constant fromValue(byte value) {
return new ByteConstant(value);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CharConstant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CharConstant.java
index 0f2c7a1e63..b18774f1fa 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CharConstant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CharConstant.java
@@ -15,7 +15,7 @@
public class CharConstant extends Constant {
- private char value;
+ private final char value;
public static Constant fromValue(char value) {
return new CharConstant(value);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index 6109b78fcf..40e2d2f111 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -45,7 +45,6 @@
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
import org.eclipse.jdt.internal.compiler.util.Util;
-@SuppressWarnings({ "rawtypes", "unchecked" })
public class CompilerOptions {
/**
@@ -618,7 +617,6 @@ public CompilerOptions(){
/**
* Initializing the compiler options with external settings
- * @param settings
*/
public CompilerOptions(Map settings){
resetDefaults();
@@ -630,7 +628,7 @@ public CompilerOptions(Map settings){
/**
* @deprecated used to preserve 3.1 and 3.2M4 compatibility of some Compiler constructors
*/
- public CompilerOptions(Map settings, boolean parseLiteralExpressionsAsConstants){
+ public CompilerOptions(Map settings, boolean parseLiteralExpressionsAsConstants){
this(settings);
this.parseLiteralExpressionsAsConstants = parseLiteralExpressionsAsConstants;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/Constant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/Constant.java
index 29a45a3928..27173b324e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/Constant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/Constant.java
@@ -22,7 +22,7 @@ public abstract class Constant implements TypeIds, OperatorIds {
public static final Constant NotAConstant = DoubleConstant.fromValue(Double.NaN);
public static final Constant[] NotAConstantList = new Constant[] {DoubleConstant.fromValue(Double.NaN)};
-
+
public boolean booleanValue() {
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "boolean" })); //$NON-NLS-1$
}
@@ -1469,10 +1469,9 @@ public double doubleValue() {
public float floatValue() {
throw new ShouldNotImplement(Messages.bind(Messages.constant_cannotCastedInto, new String[] { typeName(), "float" })); //$NON-NLS-1$
}
-
+
/**
* Returns true if both constants have the same type and the same actual value
- * @param otherConstant
*/
public boolean hasSameValue(Constant otherConstant) {
if (this == otherConstant)
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java
index 2baaaf1e23..7b9336d74d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java
@@ -15,7 +15,7 @@
public class DoubleConstant extends Constant {
- private double value;
+ private final double value;
public static Constant fromValue(double value) {
return new DoubleConstant(value);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
index 69c40b762c..afae7a0be0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
@@ -78,7 +78,7 @@ public class IrritantSet {
public static final IrritantSet JAVADOC = new IrritantSet(CompilerOptions.InvalidJavadoc);
public static final IrritantSet PREVIEW = new IrritantSet(CompilerOptions.PreviewFeatureUsed);
- public static final IrritantSet COMPILER_DEFAULT_ERRORS = new IrritantSet(0); // no optional error by default
+ public static final IrritantSet COMPILER_DEFAULT_ERRORS = new IrritantSet(0); // no optional error by default
public static final IrritantSet COMPILER_DEFAULT_WARNINGS = new IrritantSet(0); // see static initializer below
public static final IrritantSet COMPILER_DEFAULT_INFOS = new IrritantSet(0); // see static initializer below
static {
@@ -88,7 +88,7 @@ public class IrritantSet {
CompilerOptions.UnlikelyEqualsArgumentType
| CompilerOptions.SuppressWarningsNotAnalysed
| CompilerOptions.AnnotatedTypeArgumentToUnannotated);
-
+
COMPILER_DEFAULT_WARNINGS
// group-0 warnings enabled by default
.set(
@@ -187,7 +187,7 @@ public class IrritantSet {
if (suppressRawWhenUnchecked != null && "true".equalsIgnoreCase(suppressRawWhenUnchecked)) { //$NON-NLS-1$
UNCHECKED.set(CompilerOptions.RawTypeReference);
}
-
+
JAVADOC
.set(CompilerOptions.MissingJavadocComments)
.set(CompilerOptions.MissingJavadocTags);
@@ -236,8 +236,6 @@ public IrritantSet clearAll() {
/**
* Initialize a set of irritants in one group
- *
- * @param singleGroupIrritants
*/
public void initialize(int singleGroupIrritants) {
if (singleGroupIrritants == 0)
@@ -254,7 +252,6 @@ public void initialize(IrritantSet other) {
/**
* Returns true if any of the irritants in given other set is positionned in receiver
- * @param other
*/
public boolean isAnySet(IrritantSet other) {
if (other == null)
@@ -295,8 +292,6 @@ public IrritantSet set(int singleGroupIrritants) {
/**
* Return updated irritantSet or null if it was a no-op
- *
- * @param other
*/
public IrritantSet set(IrritantSet other) {
if (other == null)
@@ -313,7 +308,7 @@ public IrritantSet set(IrritantSet other) {
}
return wasNoOp ? null : this;
}
-
+
public IrritantSet setAll() {
for (int i = 0; i < GROUP_MAX; i++) {
this.bits[i] |= 0xFFFFFFFF & ~GROUP_MASK; // erase the group
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
index ea94292e52..c1d1c0f073 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
@@ -69,6 +69,10 @@ public enum JavaFeature {
Messages.bind(Messages.unnammed_patterns_and_vars),
new char[][] {},
true),
+ UNNAMMED_CLASSES_AND_INSTANCE_MAIN_METHODS(ClassFileConstants.JDK21,
+ Messages.bind(Messages.unnamed_classes_and_instance_main_methods),
+ new char[][] {},
+ true),
;
final long compliance;
@@ -98,6 +102,11 @@ public boolean isSupported(long comp, boolean preview) {
return preview;
return this.getCompliance() <= comp;
}
+ public boolean isSupported(String comp, boolean preview) {
+ if (this.isPreview)
+ return preview;
+ return this.getCompliance() <= CompilerOptions.versionToJdkLevel(comp);
+ }
JavaFeature(long compliance, String name, char[][] restrictedKeywords, boolean isPreview) {
this.compliance = compliance;
@@ -105,4 +114,4 @@ public boolean isSupported(long comp, boolean preview) {
this.isPreview = isPreview;
this.restrictedKeywords = restrictedKeywords;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/LongConstant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
index d21ee7bf9a..3a293a47a2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
@@ -17,8 +17,8 @@ public class LongConstant extends Constant {
private static final LongConstant ZERO = new LongConstant(0L);
private static final LongConstant MIN_VALUE = new LongConstant(Long.MIN_VALUE);
-
- private long value;
+
+ private final long value;
public static Constant fromValue(long value) {
if (value == 0L) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java
index 91c4623614..1677f1fd63 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java
@@ -14,8 +14,8 @@
package org.eclipse.jdt.internal.compiler.impl;
public class ShortConstant extends Constant {
-
- private short value;
+
+ private final short value;
public static Constant fromValue(short value) {
return new ShortConstant(value);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/StringConstant.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/StringConstant.java
index 6de9e0f1d8..9fa98872eb 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/StringConstant.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/StringConstant.java
@@ -15,7 +15,7 @@
public class StringConstant extends Constant {
- private String value;
+ private final String value;
public static Constant fromValue(String value) {
return new StringConstant(value);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java
index 228f1295cb..8dbc517fb1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java
@@ -11,7 +11,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contribution for
- * Bug 432977 - [1.8][null] Incorrect 'type is not visible' compiler error
+ * Bug 432977 - [1.8][null] Incorrect 'type is not visible' compiler error
* Bug 446434 - [1.8][null] Enable interned captures also when analysing null type annotations
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -20,29 +20,29 @@
import org.eclipse.jdt.internal.compiler.util.Util;
/* AnnotatableTypeSystem: Keep track of annotated types so as to provide unique bindings for identically annotated versions identical underlying "naked" types.
- As of now, we ensure uniqueness only for marker annotated types and for others that default to all default attribute values, i.e two instances of @NonNull String
- would have the same binding, while @T(1) X and @T(2) X will not. Binding uniqueness is only a memory optimization and is not essential for correctness of compilation.
+ As of now, we ensure uniqueness only for marker annotated types and for others that default to all default attribute values, i.e two instances of @NonNull String
+ would have the same binding, while @T(1) X and @T(2) X will not. Binding uniqueness is only a memory optimization and is not essential for correctness of compilation.
Various subsystems should expect to determine binding identity/equality by calling TypeBinding.equalsEquals and not by using == operator.
-
- ATS is AnnotatableTypeSystem and not AnnotatedTypeSystem, various methods may actually return unannotated types if the input arguments do not specify any annotations
- and component types of the composite type being constructed are themselves also unannotated. We rely on the master type table maintained by TypeSystem and use
+
+ ATS is AnnotatableTypeSystem and not AnnotatedTypeSystem, various methods may actually return unannotated types if the input arguments do not specify any annotations
+ and component types of the composite type being constructed are themselves also unannotated. We rely on the master type table maintained by TypeSystem and use
getDerivedTypes() and cacheDerivedType() to get/put.
*/
public class AnnotatableTypeSystem extends TypeSystem {
- private boolean isAnnotationBasedNullAnalysisEnabled;
-
+ private final boolean isAnnotationBasedNullAnalysisEnabled;
+
public AnnotatableTypeSystem(LookupEnvironment environment) {
super(environment);
this.environment = environment;
this.isAnnotationBasedNullAnalysisEnabled = environment.globalOptions.isAnnotationBasedNullAnalysisEnabled;
}
-
+
// Given a type, return all its annotated variants: parameter may be annotated.
@Override
public TypeBinding[] getAnnotatedTypes(TypeBinding type) {
-
+
TypeBinding[] derivedTypes = getDerivedTypes(type);
final int length = derivedTypes.length;
TypeBinding [] annotatedVersions = new TypeBinding[length];
@@ -56,16 +56,16 @@ public TypeBinding[] getAnnotatedTypes(TypeBinding type) {
if (derivedType.id == type.id)
annotatedVersions[versions++] = derivedType;
}
-
+
if (versions != length)
System.arraycopy(annotatedVersions, 0, annotatedVersions = new TypeBinding[versions], 0, versions);
return annotatedVersions;
}
-
- /* This method replaces the version that used to sit in LE. The parameter `annotations' is a flattened sequence of annotations,
+
+ /* This method replaces the version that used to sit in LE. The parameter `annotations' is a flattened sequence of annotations,
where each dimension's annotations end with a sentinel null. Leaf type can be an already annotated type.
-
- See ArrayBinding.swapUnresolved for further special case handling if incoming leafType is a URB that would resolve to a raw
+
+ See ArrayBinding.swapUnresolved for further special case handling if incoming leafType is a URB that would resolve to a raw
type later.
*/
@Override
@@ -86,14 +86,14 @@ public ArrayBinding getArrayType(TypeBinding leafType, int dimensions, Annotatio
if (derivedType == null) break;
if (!derivedType.isArrayType() || derivedType.dimensions() != dimensions || derivedType.leafComponentType() != leafType) //$IDENTITY-COMPARISON$
continue;
- if (Util.effectivelyEqual(derivedType.getTypeAnnotations(), annotations))
+ if (Util.effectivelyEqual(derivedType.getTypeAnnotations(), annotations))
return (ArrayBinding) derivedType;
if (!derivedType.hasTypeAnnotations())
nakedType = (ArrayBinding) derivedType;
}
if (nakedType == null)
nakedType = super.getArrayType(leafType, dimensions);
-
+
if (!haveTypeAnnotations(leafType, annotations))
return nakedType;
@@ -114,29 +114,29 @@ public ReferenceBinding getMemberType(ReferenceBinding memberType, ReferenceBind
return super.getMemberType(memberType, enclosingType);
return (ReferenceBinding) getAnnotatedType(memberType, enclosingType, memberType.getTypeAnnotations());
}
-
+
@Override
public ParameterizedTypeBinding getParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType, AnnotationBinding [] annotations) {
-
+
if (genericType.hasTypeAnnotations()) // @NonNull (List) and not (@NonNull List)
throw new IllegalStateException();
-
+
ParameterizedTypeBinding parameterizedType = this.parameterizedTypes.get(genericType, typeArguments, enclosingType, annotations);
if (parameterizedType != null)
return parameterizedType;
-
+
ParameterizedTypeBinding nakedType = super.getParameterizedType(genericType, typeArguments, enclosingType);
-
+
if (!haveTypeAnnotations(genericType, enclosingType, typeArguments, annotations))
return nakedType;
-
+
parameterizedType = new ParameterizedTypeBinding(genericType, typeArguments, enclosingType, this.environment);
parameterizedType.id = nakedType.id;
parameterizedType.setTypeAnnotations(annotations, this.isAnnotationBasedNullAnalysisEnabled);
this.parameterizedTypes.put(genericType, typeArguments, enclosingType, parameterizedType);
return (ParameterizedTypeBinding) cacheDerivedType(genericType, nakedType, parameterizedType);
}
-
+
@Override
public ParameterizedTypeBinding getParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType) {
return getParameterizedType(genericType, typeArguments, enclosingType, Binding.NO_ANNOTATIONS);
@@ -149,7 +149,7 @@ public RawTypeBinding getRawType(ReferenceBinding genericType, ReferenceBinding
if (!genericType.hasEnclosingInstanceContext() && enclosingType != null) {
enclosingType = (ReferenceBinding) enclosingType.original();
}
-
+
RawTypeBinding nakedType = null;
TypeBinding[] derivedTypes = getDerivedTypes(genericType);
for (int i = 0, length = derivedTypes.length; i < length; i++) {
@@ -165,36 +165,36 @@ public RawTypeBinding getRawType(ReferenceBinding genericType, ReferenceBinding
}
if (nakedType == null)
nakedType = super.getRawType(genericType, enclosingType);
-
+
if (!haveTypeAnnotations(genericType, enclosingType, null, annotations))
return nakedType;
-
+
RawTypeBinding rawType = new RawTypeBinding(genericType, enclosingType, this.environment);
rawType.id = nakedType.id;
rawType.setTypeAnnotations(annotations, this.isAnnotationBasedNullAnalysisEnabled);
return (RawTypeBinding) cacheDerivedType(genericType, nakedType, rawType);
}
-
+
@Override
public RawTypeBinding getRawType(ReferenceBinding genericType, ReferenceBinding enclosingType) {
return getRawType(genericType, enclosingType, Binding.NO_ANNOTATIONS);
}
-
+
@Override
public WildcardBinding getWildcard(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind, AnnotationBinding [] annotations) {
-
+
if (genericType == null) // pseudo wildcard denoting composite bounds for lub computation
genericType = ReferenceBinding.LUB_GENERIC;
if (genericType.hasTypeAnnotations())
throw new IllegalStateException();
-
+
WildcardBinding nakedType = null;
boolean useDerivedTypesOfBound = bound instanceof TypeVariableBinding || (bound instanceof ParameterizedTypeBinding && !(bound instanceof RawTypeBinding)) ;
TypeBinding[] derivedTypes = getDerivedTypes(useDerivedTypesOfBound ? bound : genericType);
for (int i = 0, length = derivedTypes.length; i < length; i++) {
TypeBinding derivedType = derivedTypes[i];
- if (derivedType == null)
+ if (derivedType == null)
break;
if (!derivedType.isWildcard() || derivedType.actualType() != genericType || derivedType.rank() != rank) //$IDENTITY-COMPARISON$
continue;
@@ -205,13 +205,13 @@ public WildcardBinding getWildcard(ReferenceBinding genericType, int rank, TypeB
if (!derivedType.hasTypeAnnotations())
nakedType = (WildcardBinding) derivedType;
}
-
+
if (nakedType == null)
nakedType = super.getWildcard(genericType, rank, bound, otherBounds, boundKind);
-
+
if (!haveTypeAnnotations(genericType, bound, otherBounds, annotations))
return nakedType;
-
+
WildcardBinding wildcard = new WildcardBinding(genericType, rank, bound, otherBounds, boundKind, this.environment);
wildcard.id = nakedType.id;
wildcard.setTypeAnnotations(annotations, this.isAnnotationBasedNullAnalysisEnabled);
@@ -228,10 +228,10 @@ public WildcardBinding getWildcard(ReferenceBinding genericType, int rank, TypeB
*/
@Override
public TypeBinding getAnnotatedType(TypeBinding type, AnnotationBinding[][] annotations) {
-
+
if (type == null || !type.isValidBinding() || annotations == null || annotations.length == 0)
return type;
-
+
TypeBinding annotatedType = null;
switch (type.kind()) {
case Binding.ARRAY_TYPE:
@@ -247,17 +247,17 @@ public TypeBinding getAnnotatedType(TypeBinding type, AnnotationBinding[][] anno
case Binding.WILDCARD_TYPE:
case Binding.INTERSECTION_TYPE:
case Binding.INTERSECTION_TYPE18:
- /* Taking the binding of QTR as an example, there could be different annotatable components, but we come in a with a single binding, e.g:
+ /* Taking the binding of QTR as an example, there could be different annotatable components, but we come in a with a single binding, e.g:
@T Z; type => Z annotations => [[@T]]
@T Y.@T Z type => Z annotations => [[@T][@T]]
- @T X.@T Y.@T Z type => Z annotations => [[@T][@T][@T]]
+ @T X.@T Y.@T Z type => Z annotations => [[@T][@T][@T]]
java.lang.@T X.@T Y.@T Z type => Z annotations => [[][][@T][@T][@T]]
in all these cases the incoming type binding is for Z, but annotations are for different levels. We need to align their layout for proper attribution.
*/
-
+
if (type.isUnresolvedType() && CharOperation.indexOf('$', type.sourceName()) > 0)
type = BinaryTypeBinding.resolveType(type, this.environment, true); // must resolve member types before asking for enclosingType
-
+
int levels = type.depth() + 1;
TypeBinding [] types = new TypeBinding[levels];
types[--levels] = type;
@@ -273,7 +273,7 @@ public TypeBinding getAnnotatedType(TypeBinding type, AnnotationBinding[][] anno
if (annotations[i] != null && annotations[i].length > 0)
break;
}
- if (i == levels) // empty annotations array ?
+ if (i == levels) // empty annotations array ?
return type;
if (j < 0) // Not kosher, broken type that is not flagged as invalid while reporting compilation error ? don't touch.
return type;
@@ -292,10 +292,10 @@ public TypeBinding getAnnotatedType(TypeBinding type, AnnotationBinding[][] anno
return annotatedType;
}
- /* Private subroutine for public APIs. Create an annotated version of the type. To materialize the annotated version, we can't use new since
- this is a general purpose method designed to deal type bindings of all types. "Clone" the incoming type, specializing for any enclosing type
- that may itself be possibly be annotated. This is so the binding for @Outer Outer.Inner != Outer.@Inner Inner != @Outer Outer.@Inner Inner.
- Likewise so the bindings for @Readonly List<@NonNull String> != @Readonly List<@Nullable String> != @Readonly List<@Interned String>
+ /* Private subroutine for public APIs. Create an annotated version of the type. To materialize the annotated version, we can't use new since
+ this is a general purpose method designed to deal type bindings of all types. "Clone" the incoming type, specializing for any enclosing type
+ that may itself be possibly be annotated. This is so the binding for @Outer Outer.Inner != Outer.@Inner Inner != @Outer Outer.@Inner Inner.
+ Likewise so the bindings for @Readonly List<@NonNull String> != @Readonly List<@Nullable String> != @Readonly List<@Interned String>
*/
private TypeBinding getAnnotatedType(TypeBinding type, TypeBinding enclosingType, AnnotationBinding[] annotations) {
if (type.kind() == Binding.PARAMETERIZED_TYPE) {
@@ -306,10 +306,10 @@ private TypeBinding getAnnotatedType(TypeBinding type, TypeBinding enclosingType
for (int i = 0, length = derivedTypes.length; i < length; i++) {
TypeBinding derivedType = derivedTypes[i];
if (derivedType == null) break;
-
+
if (derivedType.enclosingType() != enclosingType || !Util.effectivelyEqual(derivedType.typeArguments(), type.typeArguments())) //$IDENTITY-COMPARISON$
continue;
-
+
switch(type.kind()) {
case Binding.ARRAY_TYPE:
if (!derivedType.isArrayType() || derivedType.dimensions() != type.dimensions() || derivedType.leafComponentType() != type.leafComponentType()) //$IDENTITY-COMPARISON$
@@ -345,10 +345,10 @@ private TypeBinding getAnnotatedType(TypeBinding type, TypeBinding enclosingType
}
if (nakedType == null)
nakedType = getUnannotatedType(type);
-
+
if (!haveTypeAnnotations(type, enclosingType, null, annotations))
return nakedType;
-
+
TypeBinding annotatedType = type.clone(enclosingType);
annotatedType.id = nakedType.id;
annotatedType.setTypeAnnotations(annotations, this.isAnnotationBasedNullAnalysisEnabled);
@@ -389,12 +389,12 @@ private boolean haveTypeAnnotations(TypeBinding baseType, TypeBinding someType,
private boolean haveTypeAnnotations(TypeBinding leafType, AnnotationBinding[] annotations) {
return haveTypeAnnotations(leafType, null, null, annotations);
}
-
+
private boolean haveTypeAnnotations(TypeBinding memberType, TypeBinding enclosingType) {
return haveTypeAnnotations(memberType, enclosingType, null, null);
}
- /* Utility method to "flatten" annotations. For multidimensional arrays, we encode the annotations into a flat array
+ /* Utility method to "flatten" annotations. For multidimensional arrays, we encode the annotations into a flat array
where a null separates the annotations of dimension n from dimension n - 1 as well as dimenion n + 1. There is a
final null always.
*/
@@ -430,4 +430,4 @@ private boolean haveTypeAnnotations(TypeBinding memberType, TypeBinding enclosin
public boolean isAnnotatedTypeSystem() {
return true;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java
index d89877f94a..857cc6fc9b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java
@@ -31,8 +31,6 @@ public class AnnotationBinding {
* Add the standard annotations encoded in the tag bits to the recorded annotations.
*
* @param recordedAnnotations existing annotations already created
- * @param annotationTagBits
- * @param env
* @return the combined list of annotations
*/
public static AnnotationBinding[] addStandardAnnotations(AnnotationBinding[] recordedAnnotations, long annotationTagBits, LookupEnvironment env) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AptSourceLocalVariableBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AptSourceLocalVariableBinding.java
index c0ee6500f4..87ab911138 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AptSourceLocalVariableBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/AptSourceLocalVariableBinding.java
@@ -17,7 +17,7 @@ public class AptSourceLocalVariableBinding extends LocalVariableBinding {
// enclosing element
public MethodBinding methodBinding;
- private LocalVariableBinding local;
+ private final LocalVariableBinding local;
public AptSourceLocalVariableBinding(LocalVariableBinding localVariableBinding, MethodBinding methodBinding) {
super(localVariableBinding.name, localVariableBinding.type, localVariableBinding.modifiers, true);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java
index a7f49f048e..1f793b7635 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java
@@ -24,17 +24,17 @@ public class BaseTypeBinding extends TypeBinding {
public static final int WIDENING = 2;
public static final int NARROWING = 4;
public static final int MAX_CONVERSIONS = 16*16; // well-known x well-known
-
+
static {
CONVERSIONS = initializeConversions();
}
-
+
public static final int[] initializeConversions(){
// fromType destType --> conversion
// 0000 0000 0000
int[] table = new int[MAX_CONVERSIONS];
-
+
table[TypeIds.Boolean2Boolean] = IDENTITY;
table[TypeIds.Byte2Byte] = IDENTITY;
@@ -92,7 +92,7 @@ public static final int[] initializeConversions(){
table[TypeIds.Double2Long] = NARROWING;
table[TypeIds.Double2Float] = NARROWING;
table[TypeIds.Double2Double]= IDENTITY;
-
+
return table;
}
/**
@@ -104,8 +104,8 @@ public static final int[] initializeConversions(){
*/
public static final boolean isNarrowing(int left, int right) {
int right2left = right + (left<<4);
- return right2left >= 0
- && right2left < MAX_CONVERSIONS
+ return right2left >= 0
+ && right2left < MAX_CONVERSIONS
&& (CONVERSIONS[right2left] & (IDENTITY|NARROWING)) != 0;
}
@@ -118,14 +118,14 @@ public static final boolean isNarrowing(int left, int right) {
*/
public static final boolean isWidening(int left, int right) {
int right2left = right + (left<<4);
- return right2left >= 0
- && right2left < MAX_CONVERSIONS
+ return right2left >= 0
+ && right2left < MAX_CONVERSIONS
&& (CONVERSIONS[right2left] & (IDENTITY|WIDENING)) != 0;
}
-
+
public char[] simpleName;
- private char[] constantPoolName;
+ private final char[] constantPoolName;
BaseTypeBinding(int id, char[] name, char[] constantPoolName) {
this.tagBits |= TagBits.IsBaseType;
@@ -154,13 +154,13 @@ public char[] constantPoolName() {
public TypeBinding clone(TypeBinding enclosingType) {
return new BaseTypeBinding(this.id, this.simpleName, this.constantPoolName);
}
-
+
@Override
public PackageBinding getPackage() {
return null;
}
-
+
/* Answer true if the receiver type can be assigned to the argument type (right)
*/
@Override
@@ -168,13 +168,13 @@ public final boolean isCompatibleWith(TypeBinding right, Scope captureScope) {
if (equalsEquals(this, right))
return true;
int right2left = this.id + (right.id<<4);
- if (right2left >= 0
- && right2left < MAX_CONVERSIONS
+ if (right2left >= 0
+ && right2left < MAX_CONVERSIONS
&& (CONVERSIONS[right2left] & (IDENTITY|WIDENING)) != 0)
return true;
return this == TypeBinding.NULL && !right.isBaseType();
}
-
+
@Override
public void setTypeAnnotations(AnnotationBinding[] annotations, boolean evalNullAnnotations) {
super.setTypeAnnotations(annotations, false); // never set nullTagBits on base types
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index ff7d856ca4..f9cca0e080 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -114,7 +114,7 @@ public class BinaryTypeBinding extends ReferenceBinding {
protected ReferenceBinding[] memberTypes;
protected TypeVariableBinding[] typeVariables;
protected ModuleBinding module;
- private BinaryTypeBinding prototype;
+ private final BinaryTypeBinding prototype;
public URI path;
// For the link with the principle structure
@@ -288,19 +288,12 @@ public BinaryTypeBinding(BinaryTypeBinding prototype) {
/**
* Standard constructor for creating binary type bindings from binary models (classfiles)
- * @param packageBinding
- * @param binaryType
- * @param environment
*/
public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, LookupEnvironment environment) {
this(packageBinding, binaryType, environment, false);
}
/**
* Standard constructor for creating binary type bindings from binary models (classfiles)
- * @param packageBinding
- * @param binaryType
- * @param environment
- * @param needFieldsAndMethods
*/
public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, LookupEnvironment environment, boolean needFieldsAndMethods) {
@@ -523,15 +516,15 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
this.typeVariables = addMethodTypeVariables(typeVars);
}
}
+ char[] superclassName = binaryType.getSuperclassName();
+ if (CharOperation.equals(superclassName, TypeConstants.CharArray_JAVA_LANG_RECORD_SLASH)){
+ this.modifiers |= ExtraCompilerModifiers.AccRecord;
+ }
if (typeSignature == null) {
- char[] superclassName = binaryType.getSuperclassName();
if (superclassName != null) {
// attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested)
this.superclass = this.environment.getTypeFromConstantPoolName(superclassName, 0, -1, false, missingTypeNames, toplevelWalker.toSupertype((short) -1, superclassName));
this.tagBits |= TagBits.HasUnresolvedSuperclass;
- if (CharOperation.equals(superclassName, TypeConstants.CharArray_JAVA_LANG_RECORD_SLASH)){
- this.modifiers |= ExtraCompilerModifiers.AccRecord;
- }
}
this.superInterfaces = Binding.NO_SUPERINTERFACES;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java
index b0f241377b..911836ea38 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java
@@ -342,7 +342,7 @@ else if (type.hasNullTypeAnnotations())
private TypeBound[] incorporatedBounds = Binding.NO_TYPE_BOUNDS;
private TypeBound[] unincorporatedBounds = new TypeBound[8];
private int unincorporatedBoundsCount = 0;
- private TypeBound[] mostRecentBounds = new TypeBound[4]; // for quick & dirty duplicate elimination
+ private final TypeBound[] mostRecentBounds = new TypeBound[4]; // for quick & dirty duplicate elimination
public BoundSet() {}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java
index 97d1e77cfb..f1631f99c1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java
@@ -22,8 +22,8 @@
public class CaptureBinding18 extends CaptureBinding {
TypeBinding[] upperBounds;
- private char[] originalName;
- private CaptureBinding18 prototype;
+ private final char[] originalName;
+ private final CaptureBinding18 prototype;
public CaptureBinding18(ReferenceBinding contextType, char[] sourceName, char[] originalName, int start, int end, int captureID, LookupEnvironment environment) {
super(contextType, sourceName, start, end, captureID, environment);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
index 74ae857a8a..08fc9371ba 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -48,6 +48,7 @@
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.RecordComponent;
+import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
@@ -1334,42 +1335,72 @@ void connectImplicitPermittedTypes() {
void connectPermittedTypes() {
SourceTypeBinding sourceType = this.referenceContext.binding;
sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
- if (this.referenceContext.permittedTypes == null) {
- return;
- }
if (sourceType.id == TypeIds.T_JavaLangObject || sourceType.isEnum()) // already handled
return;
- int length = this.referenceContext.permittedTypes.length;
- ReferenceBinding[] permittedTypeBindings = new ReferenceBinding[length];
- int count = 0;
- nextPermittedType : for (int i = 0; i < length; i++) {
- TypeReference permittedTypeRef = this.referenceContext.permittedTypes[i];
- ReferenceBinding permittedType = findPermittedtype(permittedTypeRef);
- if (permittedType == null) { // detected cycle
- continue nextPermittedType;
- }
- // check for simple interface collisions
- // Check for a duplicate interface once the name is resolved, otherwise we may be confused (i.e. a.b.I and c.d.I)
- for (int j = 0; j < i; j++) {
- if (TypeBinding.equalsEquals(permittedTypeBindings[j], permittedType)) {
- problemReporter().sealedDuplicateTypeInPermits(sourceType, permittedTypeRef, permittedType);
+ if (this.referenceContext.permittedTypes != null) {
+ int length = this.referenceContext.permittedTypes.length;
+ ReferenceBinding[] permittedTypeBindings = new ReferenceBinding[length];
+ int count = 0;
+ nextPermittedType : for (int i = 0; i < length; i++) {
+ TypeReference permittedTypeRef = this.referenceContext.permittedTypes[i];
+ ReferenceBinding permittedType = findPermittedtype(permittedTypeRef);
+ if (permittedType == null) { // detected cycle
continue nextPermittedType;
}
+ if (!isPermittedTypeInAllowedFormat(sourceType, permittedTypeRef, permittedType))
+ continue nextPermittedType;
+
+ // check for simple interface collisions
+ // Check for a duplicate interface once the name is resolved, otherwise we may be confused (i.e. a.b.I and c.d.I)
+ for (int j = 0; j < i; j++) {
+ if (TypeBinding.equalsEquals(permittedTypeBindings[j], permittedType)) {
+ problemReporter().sealedDuplicateTypeInPermits(sourceType, permittedTypeRef, permittedType);
+ continue nextPermittedType;
+ }
+ }
+ // only want to reach here when no errors are reported
+ permittedTypeBindings[count++] = permittedType;
+ }
+ // hold onto all correctly resolved superinterfaces
+ if (count > 0) {
+ if (count != length)
+ System.arraycopy(permittedTypeBindings, 0, permittedTypeBindings = new ReferenceBinding[count], 0, count);
+ sourceType.setPermittedTypes(permittedTypeBindings);
+ } else {
+ sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
}
- // only want to reach here when no errors are reported
- permittedTypeBindings[count++] = permittedType;
}
- // hold onto all correctly resolved superinterfaces
- if (count > 0) {
- if (count != length)
- System.arraycopy(permittedTypeBindings, 0, permittedTypeBindings = new ReferenceBinding[count], 0, count);
- sourceType.setPermittedTypes(permittedTypeBindings);
- } else {
- sourceType.setPermittedTypes(Binding.NO_PERMITTEDTYPES);
+ ReferenceBinding[] memberTypes = sourceType.memberTypes;
+ if (memberTypes != null && memberTypes != Binding.NO_MEMBER_TYPES) {
+ for (int j = 0, size = memberTypes.length; j < size; j++)
+ ((SourceTypeBinding) memberTypes[j]).scope.connectPermittedTypes();
}
}
+ private boolean isPermittedTypeInAllowedFormat(SourceTypeBinding sourceType, TypeReference permittedTypeRef,
+ ReferenceBinding permittedType) {
+ if (!(permittedType.isMemberType() && permittedTypeRef instanceof SingleTypeReference))
+ return true;
+ ReferenceBinding enclosingType = permittedType.enclosingType();
+ while (enclosingType != null) {
+ if (TypeBinding.equalsEquals(sourceType, enclosingType)) {
+ CompilationUnitScope cu = this.compilationUnitScope();
+ if (cu.imports != null || cu.imports.length > 0) {
+ for (ImportBinding ib : cu.imports) {
+ Binding resolvedImport = cu.resolveSingleImport(ib, Binding.TYPE);
+ if (resolvedImport instanceof TypeBinding &&
+ TypeBinding.equalsEquals(permittedType, (TypeBinding) resolvedImport))
+ return true;
+ }
+ }
+ return false;
+ }
+ enclosingType = enclosingType.enclosingType();
+ }
+ return true;
+ }
+
private boolean connectRecordSuperclass() {
SourceTypeBinding sourceType = this.referenceContext.binding;
ReferenceBinding rootRecordType = getJavaLangRecord();
@@ -1473,7 +1504,7 @@ void connectTypeHierarchy() {
noProblems &= connectSuperInterfaces();
environment().typesBeingConnected.remove(sourceType);
sourceType.tagBits |= TagBits.EndHierarchyCheck;
- connectPermittedTypes();
+// connectPermittedTypes();
noProblems &= connectTypeVariables(this.referenceContext.typeParameters, false);
sourceType.tagBits |= TagBits.TypeVariablesAreConnected;
if (noProblems && sourceType.isHierarchyInconsistent())
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
index 658fbd17c4..8a96b509f5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -448,19 +448,26 @@ public char[] computeConstantPoolName(LocalTypeBinding localType) {
return candidateName;
}
-void connectTypeHierarchy1() {
+void connectTypeHierarchy() {
for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
this.topLevelTypes[i].scope.connectTypeHierarchy();
}
-void connectTypeHierarchy2() {
+void integrateAnnotationsInHierarchy() {
// Only now that all hierarchy information is built we're ready for ...
// ... integrating annotations
for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
this.topLevelTypes[i].scope.referenceType().updateSupertypesWithAnnotations(Collections.emptyMap());
// ... checking on permitted types
+ connectPermittedTypes();
for (int i = 0, length = this.topLevelTypes.length; i < length; i++)
this.topLevelTypes[i].scope.connectImplicitPermittedTypes();
}
+private void connectPermittedTypes() {
+ for (int i = 0, length = this.topLevelTypes.length; i < length; i++) {
+ SourceTypeBinding sourceType = this.topLevelTypes[i];
+ sourceType.scope.connectPermittedTypes();
+ }
+}
void faultInImports() {
if (this.tempImports != null)
return; // faultInImports already in progress
@@ -1065,10 +1072,6 @@ private void recordImportBinding(ImportBinding bindingToAdd) {
* Checks additional bindings (methods or types) imported from a single static import.
* Method is tried first, followed by type. If found, records them.
* If in the process, import is flagged as duplicate, -1 is returned.
- * @param compoundName
- * @param typesBySimpleNames
- * @param mask
- * @param importReference
*/
private void checkMoreStaticBindings(
char[][] compoundName,
@@ -1098,10 +1101,6 @@ private void checkMoreStaticBindings(
/**
* Checks for duplicates. If all ok, records the importBinding
* returns -1 when this import is flagged as duplicate.
- * @param importBinding
- * @param typesBySimpleNames
- * @param importReference
- * @param compoundName
* @return -1 when this import is flagged as duplicate, importPtr otherwise.
*/
private int checkAndRecordImportBinding(
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java
index 540272cc0c..e5c35fc374 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java
@@ -245,7 +245,7 @@ public Constant constant(Scope scope) {
return this.constant;
ProblemReporter problemReporter = scope.problemReporter();
IErrorHandlingPolicy suspendedPolicy = problemReporter.suspendTempErrorHandlingPolicy();
- try {
+ try (problemReporter) {
return constant();
} finally {
problemReporter.resumeTempErrorHandlingPolicy(suspendedPolicy);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java
index 8161215460..059f518ec4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java
@@ -59,7 +59,7 @@ static class InheritedNonNullnessInfo {
// delegate which to ask for recursive analysis of super methods
// can be 'this', but is never a MethodVerifier (to avoid infinite recursion).
ImplicitNullAnnotationVerifier buddyImplicitNullAnnotationsVerifier;
- private boolean inheritNullAnnotations;
+ private final boolean inheritNullAnnotations;
protected LookupEnvironment environment;
@@ -97,15 +97,15 @@ public void checkImplicitNullAnnotations(MethodBinding currentMethod, AbstractMe
// compatibility & inheritance do not consider constructors / static methods:
boolean isInstanceMethod = !currentMethod.isConstructor() && !currentMethod.isStatic();
complain &= isInstanceMethod;
- if (!needToApplyNonNullDefault
- && !complain
+ if (!needToApplyNonNullDefault
+ && !complain
&& !(this.inheritNullAnnotations && isInstanceMethod)) {
return; // short cut, no work to be done
}
if (isInstanceMethod) {
List superMethodList = new ArrayList();
-
+
// need super types connected:
if (currentType instanceof SourceTypeBinding && !currentType.isHierarchyConnected() && !currentType.isAnonymousType()) {
((SourceTypeBinding) currentType).scope.connectTypeHierarchy();
@@ -114,8 +114,8 @@ public void checkImplicitNullAnnotations(MethodBinding currentMethod, AbstractMe
int paramLen = currentMethod.parameters.length;
findAllOverriddenMethods(currentMethod.original(), currentMethod.selector, paramLen,
currentType, new HashSet(), superMethodList);
-
- // prepare interim storage for nullness info so we don't pollute currentMethod before we know its conflict-free:
+
+ // prepare interim storage for nullness info so we don't pollute currentMethod before we know its conflict-free:
InheritedNonNullnessInfo[] inheritedNonNullnessInfos = new InheritedNonNullnessInfo[paramLen+1]; // index 0 is for the return type
for (int i=0; inull elements for any type variable that could not be substituted.
*/
@@ -1146,7 +1144,6 @@ public boolean reduceAndIncorporate(ConstraintFormula constraint) throws Inferen
/** JLS 18.4 Resolution
* @param isRecordPatternTypeInference for 18.5.5_item_3_bullet_5
* @return answer null if some constraint resolved to FALSE, otherwise the boundset representing the solution
- * @throws InferenceFailureException
*/
private /*@Nullable*/ BoundSet resolve(
InferenceVariable[] toResolve,
@@ -1299,7 +1296,6 @@ public TypeBinding substitute(TypeVariableBinding typeVariable) {
/**
* JLS 18.4 Resolution
* @return answer null if some constraint resolved to FALSE, otherwise the boundset representing the solution
- * @throws InferenceFailureException
*/
private /*@Nullable*/ BoundSet resolve(InferenceVariable[] toResolve) throws InferenceFailureException {
return resolve(toResolve, false);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceSubstitution.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceSubstitution.java
index 938bfec376..52a5528ae9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceSubstitution.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/InferenceSubstitution.java
@@ -18,7 +18,7 @@
*/
public class InferenceSubstitution extends Scope.Substitutor implements Substitution {
- private LookupEnvironment environment;
+ private final LookupEnvironment environment;
private InferenceVariable[] variables;
private InvocationSite[] sites;
@@ -55,7 +55,7 @@ protected boolean isSameParameter(TypeBinding p1, TypeBinding originalType) {
return false;
}
};
-
+
int l1 = this.sites.length;
subst.sites = new InvocationSite[l1+1];
System.arraycopy(this.sites, 0, subst.sites, 0, l1);
@@ -74,7 +74,7 @@ protected boolean isSameParameter(TypeBinding p1, TypeBinding originalType) {
}
/**
- * Override method {@link Scope.Substitutor#substitute(Substitution, TypeBinding)},
+ * Override method {@link Scope.Substitutor#substitute(Substitution, TypeBinding)},
* to add substitution of types other than type variables.
*/
@Override
@@ -127,7 +127,7 @@ public TypeBinding substitute(TypeVariableBinding typeVariable) {
continue;
}
if (superInterfaces != null) {
- int ifcLen = superInterfaces.length;
+ int ifcLen = superInterfaces.length;
for (int j = 0; j < ifcLen; j++) {
if (TypeBinding.equalsEquals(pi, superInterfaces[j])) {
if (superInterfaces == typeVariable.superInterfaces)
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java
index 83ddf12553..a684ba71db 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java
@@ -25,7 +25,6 @@
import java.util.Set;
-import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
@@ -69,7 +68,7 @@ public TypeBinding clone(TypeBinding enclosingType) {
}
@Override
- protected MethodBinding[] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidInputException {
+ protected MethodBinding[] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidBindingException {
int typesLength = this.intersectingTypes.length;
MethodBinding[][] methods = new MethodBinding[typesLength][];
int contractsLength = 0;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index b24d30b4f7..ea2d7ba1e5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -98,10 +98,7 @@ public class LookupEnvironment implements ProblemReasons, TypeConstants {
public ProblemReporter problemReporter; // SHARED
public ClassFilePool classFilePool; // SHARED
// indicate in which step on the compilation we are.
- // step 1 : build the reference binding
- // step 2 : conect the hierarchy (connect bindings)
- // step 3 : build fields and method bindings.
- private int stepCompleted; // ROOT_ONLY
+ private CompleteTypeBindingsSteps stepCompleted = CompleteTypeBindingsSteps.NONE; // ROOT_ONLY
public ITypeRequestor typeRequestor; // SHARED
private SimpleLookupTable uniqueParameterizedGenericMethodBindings;
@@ -149,11 +146,37 @@ public class LookupEnvironment implements ProblemReasons, TypeConstants {
public String moduleVersion; // ROOT_ONLY
- static final int BUILD_TYPE_HIERARCHY = 1;
- static final int CHECK_AND_SET_IMPORTS = 2;
- static final int CONNECT_TYPE_HIERARCHY1 = 3;
- static final int CONNECT_TYPE_HIERARCHY2 = 4;
- static final int BUILD_FIELDS_AND_METHODS = 5;
+ static enum CompleteTypeBindingsSteps {
+ NONE,
+ CHECK_AND_SET_IMPORTS,
+ CONNECT_TYPE_HIERARCHY,
+ BUILD_FIELDS_AND_METHODS,
+ INTEGRATE_ANNOTATIONS_IN_HIERARCHY,
+ CHECK_PARAMETERIZED_TYPES;
+
+ /** Answer the next step in sequence or {@code this} when we are at the last step already. */
+ CompleteTypeBindingsSteps next() {
+ CompleteTypeBindingsSteps[] values = values();
+ int nextOrdinal = ordinal() + 1;
+ if (nextOrdinal < values.length)
+ return values[nextOrdinal];
+ return this; // no-change to signal "at end"
+ }
+
+ /** values without NONE */
+ static final CompleteTypeBindingsSteps[] realValues = Arrays.copyOfRange(values(), 1, values().length-1);
+
+ void perform(CompilationUnitScope scope) {
+ switch (this) {
+ case CHECK_AND_SET_IMPORTS -> scope.checkAndSetImports();
+ case CONNECT_TYPE_HIERARCHY -> scope.connectTypeHierarchy();
+ case BUILD_FIELDS_AND_METHODS -> scope.buildFieldsAndMethods();
+ case INTEGRATE_ANNOTATIONS_IN_HIERARCHY -> scope.integrateAnnotationsInHierarchy();
+ case CHECK_PARAMETERIZED_TYPES -> scope.checkParameterizedTypes();
+ default -> throw new IllegalArgumentException("No implementation for: " + this); //$NON-NLS-1$
+ }
+ }
+ }
static final ProblemPackageBinding TheNotFoundPackage = new ProblemPackageBinding(CharOperation.NO_CHAR, NotFound, null/*not perfect*/);
static final ProblemReferenceBinding TheNotFoundType = new ProblemReferenceBinding(CharOperation.NO_CHAR_CHAR, null, NotFound);
@@ -517,34 +540,18 @@ public void completeTypeBindings() {
this.root.completeTypeBindings();
return;
}
- this.stepCompleted = BUILD_TYPE_HIERARCHY;
-
- for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
- (this.unitBeingCompleted = this.units[i]).scope.checkAndSetImports();
- }
- this.stepCompleted = CHECK_AND_SET_IMPORTS;
-
- for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
- (this.unitBeingCompleted = this.units[i]).scope.connectTypeHierarchy1();
- }
- this.stepCompleted = CONNECT_TYPE_HIERARCHY1;
- for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
- (this.unitBeingCompleted = this.units[i]).scope.connectTypeHierarchy2();
- }
- this.stepCompleted = CONNECT_TYPE_HIERARCHY2;
-
- for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
- var unit = (this.unitBeingCompleted = this.units[i]); // GROOVY null test
- if (unit != null) {
- CompilationUnitScope unitScope = unit.scope;
- unitScope.checkParameterizedTypes();
- unitScope.buildFieldsAndMethods();
- this.units[i] = null; // release
+ this.stepCompleted = CompleteTypeBindingsSteps.NONE;
+ for (CompleteTypeBindingsSteps step : CompleteTypeBindingsSteps.values()) {
+ CompleteTypeBindingsSteps next = step.next();
+ for (int i = this.lastCompletedUnitIndex + 1; i <= this.lastUnitIndex; i++) {
+ if (next != step)
+ next.perform((this.unitBeingCompleted = this.units[i]).scope);
+ else
+ this.units[i] = null; // at last step clean up
}
+ this.stepCompleted = next;
}
- this.stepCompleted = BUILD_FIELDS_AND_METHODS;
-
this.lastCompletedUnitIndex = this.lastUnitIndex;
this.unitBeingCompleted = null;
}
@@ -566,7 +573,7 @@ public void completeTypeBindings(CompilationUnitDeclaration parsedUnit) {
this.root.completeTypeBindings(parsedUnit);
return;
}
- if (this.stepCompleted == BUILD_FIELDS_AND_METHODS) {
+ if (this.stepCompleted == this.stepCompleted.next()) {
// This can only happen because the original set of units are completely built and
// are now being processed, so we want to treat all the additional units as a group
// until they too are completely processed.
@@ -574,15 +581,10 @@ public void completeTypeBindings(CompilationUnitDeclaration parsedUnit) {
} else {
if (parsedUnit.scope == null) return; // parsing errors were too severe
- if (this.stepCompleted >= CHECK_AND_SET_IMPORTS)
- (this.unitBeingCompleted = parsedUnit).scope.checkAndSetImports();
-
- if (this.stepCompleted >= CONNECT_TYPE_HIERARCHY1)
- (this.unitBeingCompleted = parsedUnit).scope.connectTypeHierarchy1();
-
- if (this.stepCompleted >= CONNECT_TYPE_HIERARCHY2)
- (this.unitBeingCompleted = parsedUnit).scope.connectTypeHierarchy2();
-
+ for (CompleteTypeBindingsSteps step : CompleteTypeBindingsSteps.realValues) {
+ if (this.stepCompleted.compareTo(step) >= 0)
+ step.perform((this.unitBeingCompleted = parsedUnit).scope);
+ }
this.unitBeingCompleted = null;
}
}
@@ -604,12 +606,11 @@ public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean
if (parsedUnit.scope == null) return; // parsing errors were too severe
LookupEnvironment rootEnv = this.root;
CompilationUnitDeclaration previousUnitBeingCompleted = rootEnv.unitBeingCompleted;
- (rootEnv.unitBeingCompleted = parsedUnit).scope.checkAndSetImports();
- parsedUnit.scope.connectTypeHierarchy1();
- parsedUnit.scope.connectTypeHierarchy2();
- parsedUnit.scope.checkParameterizedTypes();
- if (buildFieldsAndMethods)
- parsedUnit.scope.buildFieldsAndMethods();
+ for (CompleteTypeBindingsSteps step : CompleteTypeBindingsSteps.realValues) {
+ if (step != CompleteTypeBindingsSteps.BUILD_FIELDS_AND_METHODS || buildFieldsAndMethods)
+ step.perform((rootEnv.unitBeingCompleted = parsedUnit).scope);
+ }
+
rootEnv.unitBeingCompleted = previousUnitBeingCompleted;
}
@@ -623,29 +624,13 @@ public void completeTypeBindings(CompilationUnitDeclaration parsedUnit, boolean
*/
public void completeTypeBindings(CompilationUnitDeclaration[] parsedUnits, boolean[] buildFieldsAndMethods, int unitCount) {
LookupEnvironment rootEnv = this.root;
- for (int i = 0; i < unitCount; i++) {
- CompilationUnitDeclaration parsedUnit = parsedUnits[i];
- if (parsedUnit.scope != null)
- (rootEnv.unitBeingCompleted = parsedUnit).scope.checkAndSetImports();
- }
-
- for (int i = 0; i < unitCount; i++) {
- CompilationUnitDeclaration parsedUnit = parsedUnits[i];
- if (parsedUnit.scope != null)
- (rootEnv.unitBeingCompleted = parsedUnit).scope.connectTypeHierarchy1();
- }
- for (int i = 0; i < unitCount; i++) {
- CompilationUnitDeclaration parsedUnit = parsedUnits[i];
- if (parsedUnit.scope != null)
- (rootEnv.unitBeingCompleted = parsedUnit).scope.connectTypeHierarchy2();
- }
-
- for (int i = 0; i < unitCount; i++) {
- CompilationUnitDeclaration parsedUnit = parsedUnits[i];
- if (parsedUnit.scope != null) {
- (rootEnv.unitBeingCompleted = parsedUnit).scope.checkParameterizedTypes();
- if (buildFieldsAndMethods[i])
- parsedUnit.scope.buildFieldsAndMethods();
+ for (CompleteTypeBindingsSteps step : CompleteTypeBindingsSteps.realValues) {
+ for (int i = 0; i < unitCount; i++) {
+ CompilationUnitDeclaration parsedUnit = parsedUnits[i];
+ if (parsedUnit.scope != null)
+ if (step != CompleteTypeBindingsSteps.BUILD_FIELDS_AND_METHODS || buildFieldsAndMethods[i]) {
+ step.perform((rootEnv.unitBeingCompleted = parsedUnit).scope);
+ }
}
}
@@ -2212,7 +2197,7 @@ public void reset() {
this.root.reset();
return;
}
- this.stepCompleted = 0;
+ this.stepCompleted = CompleteTypeBindingsSteps.NONE;
this.knownModules = new HashtableOfModule();
this.UnNamedModule = new ModuleBinding.UnNamedModule(this);
this.module = this.UnNamedModule;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
index 8003ebfd13..176c59a048 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
@@ -501,8 +501,6 @@ public final char[] constantPoolName() {
/**
* After method verifier has finished, fill in missing @NonNull specification from the applicable default.
- * @param needToApplyParameterNonNullDefault
- * @param needToApplyReturnNonNullDefault
*/
protected void fillInDefaultNonNullness(AbstractMethodDeclaration sourceMethod, boolean needToApplyReturnNonNullDefault, ParameterNonNullDefaultProvider needToApplyParameterNonNullDefault) {
if (this.parameterNonNullness == null)
@@ -1474,7 +1472,6 @@ public void updateTypeVariableBinding(TypeVariableBinding previousBinding, TypeV
*
It has a single variable arity parameter (§8.4.1) whose declared type is Object[].
*
It is native.
*
- * @param scope
* @return true if the method has Polymorphic Signature
*/
public boolean hasPolymorphicSignature(Scope scope) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java
index 5448343441..aa1d0f1784 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java
@@ -23,9 +23,6 @@ public class MissingTypeBinding extends BinaryTypeBinding {
/**
* Special constructor for constructing proxies of missing types (114349)
- * @param packageBinding
- * @param compoundName
- * @param environment
*/
public MissingTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) {
this.compoundName = compoundName;
@@ -76,7 +73,6 @@ public int problemId() {
/**
* Only used to fixup the superclass hierarchy of proxy binary types
- * @param missingSuperclass
* @see LookupEnvironment#createMissingType(PackageBinding, char[][])
*/
void setMissingSuperclass(ReferenceBinding missingSuperclass) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java
index f30e61acd4..98feeb97b3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java
@@ -145,7 +145,7 @@ public String toString() {
public int defaultNullness = NO_NULL_DEFAULT;
ModuleBinding[] requiredModules = null;
boolean isAuto = false;
- private boolean[] isComplete = new boolean[UpdateKind.values().length];
+ private final boolean[] isComplete = new boolean[UpdateKind.values().length];
private Set transitiveRequires;
SimpleLookupTable storedAnnotations = null;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java
index bc89a8fd01..07c34c0837 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java
@@ -22,21 +22,21 @@
*/
public class MostSpecificExceptionMethodBinding extends MethodBinding {
- private MethodBinding originalMethod;
-
+ private final MethodBinding originalMethod;
+
public MostSpecificExceptionMethodBinding (MethodBinding originalMethod, ReferenceBinding[] mostSpecificExceptions) {
super(
- originalMethod.modifiers,
- originalMethod.selector,
- originalMethod.returnType,
- originalMethod.parameters,
- mostSpecificExceptions,
+ originalMethod.modifiers,
+ originalMethod.selector,
+ originalMethod.returnType,
+ originalMethod.parameters,
+ mostSpecificExceptions,
originalMethod.declaringClass);
this.originalMethod = originalMethod;
this.parameterNonNullness = originalMethod.parameterNonNullness;
this.defaultNullness = originalMethod.defaultNullness;
}
-
+
@Override
public MethodBinding original() {
return this.originalMethod.original();
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
index d666d9d5a3..128759c199 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
@@ -785,9 +785,7 @@ private static class LingeringTypeVariableEliminator implements Substitution {
final private Scope scope;
/**
- * @param variables
* @param substitutes when null, substitute type variable by unbounded wildcard
- * @param scope
*/
public LingeringTypeVariableEliminator(TypeVariableBinding [] variables, TypeBinding [] substitutes, Scope scope) {
this.variables = variables;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
index ad9e23f8d3..f15f95591b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
@@ -54,7 +54,6 @@
import java.util.Set;
import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.NullAnnotationMatching;
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
@@ -1724,7 +1723,7 @@ public RecordComponentBinding[] unResolvedComponents() {
}
@Override
- protected MethodBinding[] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidInputException {
+ protected MethodBinding[] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidBindingException {
if (replaceWildcards) {
TypeBinding[] types = getNonWildcardParameters(scope);
if (types == null)
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java
index 238f2f5421..3f41a87f3f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java
@@ -15,12 +15,12 @@
public class PolyParameterizedGenericMethodBinding extends ParameterizedGenericMethodBinding { // confused citizen.
- private ParameterizedGenericMethodBinding wrappedBinding;
+ private final ParameterizedGenericMethodBinding wrappedBinding;
public PolyParameterizedGenericMethodBinding(ParameterizedGenericMethodBinding applicableMethod) {
super(applicableMethod.originalMethod, applicableMethod.typeArguments, applicableMethod.environment, applicableMethod.inferredWithUncheckedConversion, false, applicableMethod.targetType);
this.wrappedBinding = applicableMethod;
}
-
+
@Override
public boolean equals(Object other) {
if (other instanceof PolyParameterizedGenericMethodBinding) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java
index 77ae76105d..dc99d21b48 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java
@@ -18,7 +18,7 @@
public class ProblemBinding extends Binding {
public char[] name;
public ReferenceBinding searchType;
- private int problemId;
+ private final int problemId;
// NOTE: must only answer the subset of the name related to the problem
public ProblemBinding(char[][] compoundName, int problemId) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java
index a647fb377d..b946479681 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java
@@ -14,7 +14,7 @@
package org.eclipse.jdt.internal.compiler.lookup;
public class ProblemFieldBinding extends FieldBinding {
- private int problemId;
+ private final int problemId;
public FieldBinding closestMatch;
// NOTE: must only answer the subset of the name related to the problem
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java
index 2c120b0ab7..9c1a8ffb27 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java
@@ -18,7 +18,7 @@
public class ProblemMethodBinding extends MethodBinding {
- private int problemReason;
+ private final int problemReason;
public MethodBinding closestMatch; // TODO (philippe) should rename into #alternateMatch
public InferenceContext18 inferenceContext; // inference context may help to coordinate error reporting
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java
index efe9f8b301..77e447395a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java
@@ -14,7 +14,7 @@
package org.eclipse.jdt.internal.compiler.lookup;
public class ProblemPackageBinding extends PlainPackageBinding {
- private int problemId;
+ private final int problemId;
// NOTE: must only answer the subset of the name related to the problem
ProblemPackageBinding(char[][] compoundName, int problemId, LookupEnvironment environment) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java
index e76b8ff968..0e1710f57d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java
@@ -21,7 +21,7 @@
@SuppressWarnings("rawtypes")
public class ProblemReferenceBinding extends ReferenceBinding {
ReferenceBinding closestMatch;
- private int problemReason;
+ private final int problemReason;
// NOTE: must only answer the subset of the name related to the problem
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index c469d10ea1..f4f2d7b6e5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -57,7 +57,6 @@
import java.util.Comparator;
import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.internal.compiler.ast.LambdaExpression;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.NullAnnotationMatching;
@@ -175,8 +174,6 @@ public static FieldBinding binarySearch(char[] name, FieldBinding[] sortedFields
* (remember methods are sorted alphabetically on selectors), and end is the index of last contiguous methods with same
* selector.
* -1 means no method got found
- * @param selector
- * @param sortedMethods
* @return (start + (end<<32)) or -1 if no method found
*/
public static long binarySearch(char[] selector, MethodBinding[] sortedMethods) {
@@ -2041,7 +2038,7 @@ public char[] sourceName() {
* Perform an upwards type projection as per JLS 4.10.5
* @param scope Relevant scope for evaluating type projection
* @param mentionedTypeVariables Filter for mentioned type variabled
- * @returns Upwards type projection of 'this', or null if downwards projection is undefined
+ * @return Upwards type projection of 'this', or null if downwards projection is undefined
*/
@Override
public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) {
@@ -2052,7 +2049,7 @@ public ReferenceBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTy
* Perform a downwards type projection as per JLS 4.10.5
* @param scope Relevant scope for evaluating type projection
* @param mentionedTypeVariables Filter for mentioned type variabled
- * @returns Downwards type projection of 'this', or null if downwards projection is undefined
+ * @return Downwards type projection of 'this', or null if downwards projection is undefined
*/
@Override
public ReferenceBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) {
@@ -2225,10 +2222,10 @@ protected int applyCloseableInterfaceWhitelists() {
return 0;
}
-protected MethodBinding [] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidInputException {
+protected MethodBinding [] getInterfaceAbstractContracts(Scope scope, boolean replaceWildcards, boolean filterDefaultMethods) throws InvalidBindingException {
if (!isInterface() || !isValidBinding()) {
- throw new InvalidInputException("Not a functional interface"); //$NON-NLS-1$
+ throw new InvalidBindingException("Not a functional interface"); //$NON-NLS-1$
}
MethodBinding [] methods = methods();
@@ -2255,7 +2252,7 @@ protected int applyCloseableInterfaceWhitelists() {
if (method == null || method.isStatic() || method.redeclaresPublicObjectMethod(scope) || method.isPrivate())
continue;
if (!method.isValidBinding())
- throw new InvalidInputException("Not a functional interface"); //$NON-NLS-1$
+ throw new InvalidBindingException("Not a functional interface"); //$NON-NLS-1$
for (int j = 0; j < contractsCount;) {
if ( contracts[j] != null && MethodVerifier.doesMethodOverride(method, contracts[j], environment)) {
contractsCount--;
@@ -2348,7 +2345,7 @@ public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcar
return this.singleAbstractMethod[index] = samProblemBinding;
}
}
- } catch (InvalidInputException e) {
+ } catch (InvalidBindingException e) {
return this.singleAbstractMethod[index] = samProblemBinding;
}
if (methods.length == 1)
@@ -2496,4 +2493,11 @@ public boolean hasEnclosingInstanceContext() {
return !enclosingMethod.isStatic();
return false;
}
+static class InvalidBindingException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ InvalidBindingException(String message) {
+ super(message);
+ }
+}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBindingSetWrapper.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBindingSetWrapper.java
index e411ed14ad..bea72766b5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBindingSetWrapper.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBindingSetWrapper.java
@@ -23,7 +23,7 @@
final class ReferenceBindingSetWrapper {
final ReferenceBinding referenceBinding;
- private int hashCode;
+ private final int hashCode;
ReferenceBindingSetWrapper(ReferenceBinding referenceBinding) {
this.referenceBinding = referenceBinding;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index 9806a6b336..5157082ff3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -892,8 +892,6 @@ protected final MethodBinding computeCompatibleMethod(MethodBinding method, Type
/**
* Connect type variable supertypes, and returns true if no problem was detected
- * @param typeParameters
- * @param checkForErasedCandidateCollisions
*/
protected boolean connectTypeVariables(TypeParameter[] typeParameters, boolean checkForErasedCandidateCollisions) {
/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 - We used to not bother with connecting
@@ -2247,7 +2245,12 @@ public Binding getBinding(char[] name, int mask, InvocationSite invocationSite,
if (importReference != null && needResolve) {
importReference.bits |= ASTNode.Used;
}
- invocationSite.setActualReceiverType(foundField.declaringClass);
+ TypeBinding importedType = this.getType(importBinding.compoundName, importBinding.compoundName.length-1);
+ if (importedType instanceof ReferenceBinding && importBinding.isValidBinding()) {
+ invocationSite.setActualReceiverType((ReferenceBinding) importedType);
+ } else {
+ invocationSite.setActualReceiverType(foundField.declaringClass);
+ }
if (foundField.isValidBinding()) {
return foundField;
}
@@ -2259,12 +2262,14 @@ public Binding getBinding(char[] name, int mask, InvocationSite invocationSite,
}
// check on demand imports
boolean foundInImport = false;
+ ReferenceBinding sourceCodeReceiver = null;
for (int i = 0, length = imports.length; i < length; i++) {
ImportBinding importBinding = imports[i];
if (importBinding.isStatic() && importBinding.onDemand) {
Binding resolvedImport = importBinding.resolvedImport;
if (resolvedImport instanceof ReferenceBinding) {
- FieldBinding temp = findField((ReferenceBinding) resolvedImport, name, invocationSite, needResolve);
+ ReferenceBinding importedReferenceBinding = (ReferenceBinding) resolvedImport;
+ FieldBinding temp = findField(importedReferenceBinding, name, invocationSite, needResolve);
if (temp != null) {
if (!temp.isValidBinding()) {
if (problemField == null)
@@ -2283,6 +2288,7 @@ public Binding getBinding(char[] name, int mask, InvocationSite invocationSite,
name,
ProblemReasons.Ambiguous);
foundField = temp;
+ sourceCodeReceiver = importedReferenceBinding;
foundInImport = true;
}
}
@@ -2290,7 +2296,10 @@ public Binding getBinding(char[] name, int mask, InvocationSite invocationSite,
}
}
if (foundField != null) {
- invocationSite.setActualReceiverType(foundField.declaringClass);
+ if (sourceCodeReceiver != null)
+ invocationSite.setActualReceiverType(sourceCodeReceiver);
+ else
+ invocationSite.setActualReceiverType(foundField.declaringClass);
return foundField;
}
}
@@ -2726,6 +2735,7 @@ public MethodBinding getImplicitMethod(char[] selector, TypeBinding[] argumentTy
scope = scope.parent;
}
+ Map method2sourceDeclaring = new HashMap<>();
if (insideStaticContext && options.sourceLevel >= ClassFileConstants.JDK1_5) {
if (foundProblem != null) {
if (foundProblem.declaringClass != null && foundProblem.declaringClass.id == TypeIds.T_JavaLangObject)
@@ -2748,15 +2758,25 @@ public MethodBinding getImplicitMethod(char[] selector, TypeBinding[] argumentTy
Binding resolvedImport = importBinding.resolvedImport;
MethodBinding possible = null;
if (importBinding.onDemand) {
- if (!skipOnDemand && resolvedImport instanceof ReferenceBinding)
+ if (!skipOnDemand && resolvedImport instanceof ReferenceBinding) {
// answers closest approximation, may not check argumentTypes or visibility
- possible = findMethod((ReferenceBinding) resolvedImport, selector, argumentTypes, invocationSite, true);
+ ReferenceBinding resolvedImportReferenceBinding = (ReferenceBinding) resolvedImport;
+ possible = findMethod(resolvedImportReferenceBinding, selector, argumentTypes, invocationSite, true);
+ if (possible != null && possible.isValidBinding())
+ method2sourceDeclaring.put(possible, resolvedImportReferenceBinding);
+ }
} else {
if (resolvedImport instanceof MethodBinding) {
MethodBinding staticMethod = (MethodBinding) resolvedImport;
- if (CharOperation.equals(staticMethod.selector, selector))
+ if (CharOperation.equals(staticMethod.selector, selector)) {
// answers closest approximation, may not check argumentTypes or visibility
possible = findMethod(staticMethod.declaringClass, selector, argumentTypes, invocationSite, true);
+ if (possible != null && possible.isValidBinding()) {
+ TypeBinding importedType = getType(importBinding.compoundName, importBinding.compoundName.length-1);
+ if (importedType instanceof ReferenceBinding && importedType.isValidBinding())
+ method2sourceDeclaring.put(possible, (ReferenceBinding) importedType);
+ }
+ }
} else if (resolvedImport instanceof FieldBinding) {
// check to see if there are also methods with the same name
FieldBinding staticField = (FieldBinding) resolvedImport;
@@ -2778,6 +2798,7 @@ public MethodBinding getImplicitMethod(char[] selector, TypeBinding[] argumentTy
MethodBinding compatibleMethod = computeCompatibleMethod(possible, argumentTypes, invocationSite);
if (compatibleMethod != null) {
if (compatibleMethod.isValidBinding()) {
+ method2sourceDeclaring.put(compatibleMethod, method2sourceDeclaring.get(possible));
if (compatibleMethod.canBeSeenBy(unitScope.fPackage)) {
if (!skipOnDemand && !importBinding.onDemand) {
visible = null; // forget previous matches from on demand imports
@@ -2818,7 +2839,12 @@ public MethodBinding getImplicitMethod(char[] selector, TypeBinding[] argumentTy
}
if (foundMethod != null) {
- invocationSite.setActualReceiverType(foundMethod.declaringClass);
+ ReferenceBinding sourceDeclaring = method2sourceDeclaring.get(foundMethod);
+ if (sourceDeclaring != null) {
+ invocationSite.setActualReceiverType(sourceDeclaring);
+ } else {
+ invocationSite.setActualReceiverType(foundMethod.declaringClass);
+ }
return foundMethod;
}
if (foundProblem != null)
@@ -5177,6 +5203,7 @@ private int parameterCompatibilityLevel(TypeBinding arg, TypeBinding param, Look
return NOT_COMPATIBLE;
}
+ /** See also the contract of {@link ProblemReporter#close()}. */
public abstract ProblemReporter problemReporter();
public final CompilationUnitDeclaration referenceCompilationUnit() {
@@ -5457,7 +5484,6 @@ public boolean recordNonNullByDefault(Binding target, int value, Annotation anno
/**
* Check whether the given null default is redundant at the given position inside this scope.
* @param nullBits locally defined nullness default, see Binding.NullnessDefaultMASK
- * @param sourceStart
* @return enclosing binding that already has a matching NonNullByDefault annotation,
* or the special binding {@link #NOT_REDUNDANT}, indicating that a different enclosing nullness default was found,
* or null to indicate that no enclosing nullness default was found.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java
index 4e4fa4b504..c5aed51d26 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java
@@ -23,7 +23,7 @@ public class SignatureWrapper {
public int start;
public int end;
public int bracket;
- private boolean use15specifics;
+ private final boolean use15specifics;
private boolean useExternalAnnotations;
public SignatureWrapper(char[] signature, boolean use15specifics) {
@@ -106,7 +106,6 @@ else if (this.end == -1)
*
* But for the signature (Lp18/Klass<TT;>.MethodInfo<Ljava/lang/String;>.InnerMethodInfo<Ljava/lang/String;>;)V
* it produces (Lp18/Klass.MethodInfo.InnerMethodInfo;)V
- *
*/
private void removeTypeArguments() {
StringBuilder buffer = new StringBuilder();
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index b26ceba6b7..d789b6a759 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -1478,7 +1478,8 @@ public RecordComponentBinding[] components() {
for (MethodBinding method : this.methods) {
if (method instanceof SyntheticMethodBinding) {
SyntheticMethodBinding smb = (SyntheticMethodBinding) method;
- if (smb.purpose == SyntheticMethodBinding.RecordCanonicalConstructor) {
+ if (smb.purpose == SyntheticMethodBinding.RecordCanonicalConstructor
+ && smb.parameters.length == this.components.length) {
for (int i = 0, l = smb.parameters.length; i < l; ++i) {
smb.parameters[i] = this.components[i].type;
}
@@ -1706,6 +1707,17 @@ public long getAnnotationTagBits() {
}
return this.tagBits;
}
+@Override
+public boolean isReadyForAnnotations() {
+ if ((this.tagBits & TagBits.AnnotationResolved) != 0)
+ return true;
+ TypeDeclaration type;
+ if (this.scope != null && (type = this.scope.referenceType()) != null) {
+ if (type.annotations == null)
+ return true; // nothing here to resolve
+ }
+ return false;
+}
public MethodBinding[] getDefaultAbstractMethods() {
if (!isPrototype())
return this.prototype.getDefaultAbstractMethods();
@@ -2271,7 +2283,7 @@ public boolean hasMemberTypes() {
private int getImplicitCanonicalConstructor() {
if (this.methods != null && this.scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK14) {
- for (int i = 0, n = this.methods.length; i < n; i += 1) {
+ for (int i = 0, l = this.methods.length; i < l; ++i) {
MethodBinding method = this.methods[i];
if (method.isCanonicalConstructor() && method.isImplicit())
return i;
@@ -2805,7 +2817,7 @@ public FieldBinding resolveTypeFor(FieldBinding field) {
public MethodBinding resolveTypesFor(MethodBinding method) {
ProblemReporter problemReporter = this.scope.problemReporter();
IErrorHandlingPolicy suspendedPolicy = problemReporter.suspendTempErrorHandlingPolicy();
- try {
+ try (problemReporter) {
return resolveTypesWithSuspendedTempErrorHandlingPolicy(method);
} finally {
problemReporter.resumeTempErrorHandlingPolicy(suspendedPolicy);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java
index b17afb0a7a..789c996591 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java
@@ -20,10 +20,10 @@
*/
public class SyntheticFactoryMethodBinding extends MethodBinding {
- private MethodBinding staticFactoryFor;
- private LookupEnvironment environment;
- private ReferenceBinding enclosingType;
-
+ private final MethodBinding staticFactoryFor;
+ private final LookupEnvironment environment;
+ private final ReferenceBinding enclosingType;
+
public SyntheticFactoryMethodBinding(MethodBinding method, LookupEnvironment environment, ReferenceBinding enclosingType) {
super(method.modifiers | ClassFileConstants.AccStatic, TypeConstants.SYNTHETIC_STATIC_FACTORY,
null, null, null, method.declaringClass);
@@ -31,14 +31,13 @@ public SyntheticFactoryMethodBinding(MethodBinding method, LookupEnvironment env
this.staticFactoryFor = method;
this.enclosingType = enclosingType;
}
-
+
public MethodBinding getConstructor() {
return this.staticFactoryFor;
}
-
+
/** Apply the given type arguments on the (declaring class of the) actual constructor being represented by this factory method and
- if method type arguments is not empty materialize the parameterized generic constructor
- * @param targetType
+ if method type arguments is not empty materialize the parameterized generic constructor
*/
public ParameterizedMethodBinding applyTypeArgumentsOnConstructor(TypeBinding[] typeArguments, TypeBinding[] constructorTypeArguments, boolean inferredWithUncheckedConversion, TypeBinding targetType) {
ReferenceBinding parameterizedType = typeArguments == null
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
index c6978b1d59..ed03aa77ec 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
@@ -235,7 +235,6 @@ public TypeBinding closestMatch() {
/**
* Iterate through the type components to collect instances of leaf missing types
- * @param missingTypes
* @return missing types
*/
public List collectMissingTypes(List missingTypes) {
@@ -306,7 +305,7 @@ public TypeBinding erasure() {
* Perform an upwards type projection as per JLS 4.10.5
* @param scope Relevant scope for evaluating type projection
* @param mentionedTypeVariables Filter for mentioned type variabled
- * @returns Upwards type projection of 'this', or null if downwards projection is undefined
+ * @return Upwards type projection of 'this', or null if downwards projection is undefined
*/
public TypeBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) {
return this;
@@ -316,7 +315,7 @@ public TypeBinding upwardsProjection(Scope scope, TypeBinding[] mentionedTypeVar
* Perform a downwards type projection as per JLS 4.10.5
* @param scope Relevant scope for evaluating type projection
* @param mentionedTypeVariables Filter for mentioned type variabled
- * @returns Downwards type projection of 'this', or null if downwards projection is undefined
+ * @return Downwards type projection of 'this', or null if downwards projection is undefined
*/
public TypeBinding downwardsProjection(Scope scope, TypeBinding[] mentionedTypeVariables) {
return this;
@@ -1175,6 +1174,9 @@ private boolean isProvablyDistinctTypeArgument(TypeBinding otherArgument, final
}
}
+public boolean isReadyForAnnotations() {
+ return true;
+}
/**
* Answer true if the receiver is an annotation which may be repeatable. Overridden as appropriate.
*/
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/messages.properties b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/messages.properties
index 1e8135c5e7..e6a02818e1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/messages.properties
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/messages.properties
@@ -74,4 +74,5 @@ records = Records
sealed_types = Sealed Types
pattern_matching_switch = Pattern Matching in Switch
record_patterns = Record Pattern
-unnammed_patterns_and_vars = Unnammed Patterns and Variables
\ No newline at end of file
+unnammed_patterns_and_vars = Unnammed Patterns and Variables
+unnamed_classes_and_instance_main_methods = Unnamed Classes and Instance Main Methods
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
index 96717b188b..4e3c5a0898 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
@@ -683,7 +683,7 @@ protected Object parseArguments(Object receiver, boolean checkVerifySpaceOrEndCo
}
// Something wrong happened => Invalid input
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
} finally {
// we have to make sure that this is reset to the previous value even if an exception occurs
this.scanner.tokenizeWhiteSpace = tokenWhiteSpace;
@@ -1175,11 +1175,11 @@ protected Object parseQualifiedName(boolean reset, boolean allowModule) throws I
break;
case TerminalTokens.TokenNameRestrictedIdentifierYield:
- throw new InvalidInputException(); // unexpected.
+ throw Scanner.invalidInput(); // unexpected.
case TerminalTokens.TokenNameDOT :
if ((iToken & 1) == 0) { // dots must be even tokens
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
consumeToken();
break;
@@ -1246,7 +1246,7 @@ protected Object parseQualifiedName(boolean reset, boolean allowModule) throws I
case TerminalTokens.TokenNameDIVIDE:
if (parsingJava15Plus && lookForModule) {
if (((iToken & 1) == 0) || (moduleRefTokenCount > 0)) { // '/' must be even token
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
moduleRefTokenCount = (iToken+1) / 2;
consumeToken();
@@ -1284,7 +1284,7 @@ protected Object parseQualifiedName(boolean reset, boolean allowModule) throws I
}
// $FALL-THROUGH$ - fall through default case to raise exception
default:
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
break nextToken;
@@ -1505,7 +1505,7 @@ protected boolean parseSnippet() throws InvalidInputException {
boolean parsingJava18Plus = this.scanner != null ? this.scanner.sourceLevel >= ClassFileConstants.JDK18 : false;
boolean valid = true;
if (!parsingJava18Plus) {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
Object snippetTag = null;
this.nonRegionTagCount = 0;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java
index a4d973657b..ddb9b68aa2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java
@@ -21,6 +21,13 @@ public interface ConflictedParser {
we treat the type annotation as a declarative annotation.
*/
boolean atConflictScenario(int token);
+
+ /* Return true if at the configuration the parser finds itself in, it would shift the token.
+ It is axiomatic of the push down automaton that corresponds to the LALR grammar that it
+ will never shift on invalid input.
+ */
+ boolean automatonWillShift(int token);
+
/*
* Return true if the parser is parsing a module declaration. In Java 9, module, requires, exports,
* to, uses, provides, and with are restricted keywords (i.e. they are keywords solely where they
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
index f782f377c2..890bbf9eb0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java
@@ -70,7 +70,7 @@ public class JavadocParser extends AbstractCommentParser {
// see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222900"
private int tagWaitingForDescription;
- private ArrayList regionNames = new ArrayList<>();
+ private final ArrayList regionNames = new ArrayList<>();
private int regionPosition = -1;
public JavadocParser(Parser sourceParser) {
@@ -201,7 +201,7 @@ protected Object createArgumentReference(char[] name, int dim, boolean isVarargs
return new JavadocArgumentExpression(name, argTypeRef.sourceStart, argEnd, argTypeRef);
}
catch (ClassCastException ex) {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
@@ -233,7 +233,7 @@ protected Object createFieldReference(Object receiver) throws InvalidInputExcept
return field;
}
catch (ClassCastException ex) {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
@@ -284,7 +284,7 @@ protected Object createMethodReference(Object receiver, List arguments) throws I
}
}
} else {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
// Create node
@@ -336,7 +336,7 @@ protected Object createMethodReference(Object receiver, List arguments) throws I
}
}
catch (ClassCastException ex) {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocScanner.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocScanner.java
index cc21b6c977..46a46b352a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocScanner.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocScanner.java
@@ -19,9 +19,9 @@
public class JavadocScanner extends Scanner{
public boolean tokenizeSingleQuotes = false;
-
+
public boolean considerRegexInStringLiteral = false;
-
+
public JavadocScanner() {
this(false /*comment*/, false /*whitespace*/, false /*nls*/, ClassFileConstants.JDK1_3 /*sourceLevel*/, null/*taskTag*/, null/*taskPriorities*/, true /*taskCaseSensitive*/);
}
@@ -71,7 +71,7 @@ public JavadocScanner(
taskPriorities,
isTaskCaseSensitive,
isPreviewEnabled);
-
+
}
public JavadocScanner(
@@ -94,7 +94,7 @@ public JavadocScanner(
isTaskCaseSensitive,
false);
}
-
+
public JavadocScanner(
boolean tokenizeComments,
boolean tokenizeWhiteSpace,
@@ -144,7 +144,7 @@ protected int scanForStringLiteral() throws InvalidInputException {
while (this.currentCharacter != '"') {
boolean isRegex = false;
if (this.currentPosition >= this.eofPosition) {
- throw new InvalidInputException(UNTERMINATED_STRING);
+ throw unterminatedString();
}
/**** \r and \n are not valid in string literals ****/
if ((this.currentCharacter == '\n') || (this.currentCharacter == '\r')) {
@@ -167,13 +167,13 @@ protected int scanForStringLiteral() throws InvalidInputException {
break;
}
if (this.currentCharacter == '\"') {
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
}
} else {
this.currentPosition--; // set current position on new line character
}
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
if (this.currentCharacter == '\\') {
if (this.unicodeAsBackSlash) {
@@ -225,7 +225,7 @@ protected int scanForStringLiteral() throws InvalidInputException {
}
} catch (IndexOutOfBoundsException e) {
this.currentPosition--;
- throw new InvalidInputException(UNTERMINATED_STRING);
+ throw unterminatedString();
} catch (InvalidInputException e) {
if (e.getMessage().equals(INVALID_ESCAPE)) {
// relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
@@ -246,9 +246,9 @@ protected int scanForStringLiteral() throws InvalidInputException {
return TokenNameStringLiteral;
} else {
return super.scanForStringLiteral();
- }
+ }
}
-
+
@Override
protected int processSingleQuotes(boolean checkIfUnicode) throws InvalidInputException{
if (this.tokenizeSingleQuotes) {
@@ -278,7 +278,7 @@ protected int scanForSingleQuoteStringLiteral() throws InvalidInputException {
while (this.currentCharacter != '\'') {
boolean isRegex = false;
if (this.currentPosition >= this.eofPosition) {
- throw new InvalidInputException(UNTERMINATED_STRING);
+ throw unterminatedString();
}
/**** \r and \n are not valid in string literals ****/
if ((this.currentCharacter == '\n') || (this.currentCharacter == '\r')) {
@@ -301,13 +301,13 @@ protected int scanForSingleQuoteStringLiteral() throws InvalidInputException {
break;
}
if (this.currentCharacter == '\'') {
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
}
} else {
this.currentPosition--; // set current position on new line character
}
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
if (this.currentCharacter == '\\') {
if (this.unicodeAsBackSlash) {
@@ -361,7 +361,7 @@ protected int scanForSingleQuoteStringLiteral() throws InvalidInputException {
}
} catch (IndexOutOfBoundsException e) {
this.currentPosition--;
- throw new InvalidInputException(UNTERMINATED_STRING);
+ throw unterminatedString();
} catch (InvalidInputException e) {
if (e.getMessage().equals(INVALID_ESCAPE)) {
// relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
@@ -379,7 +379,7 @@ protected int scanForSingleQuoteStringLiteral() throws InvalidInputException {
}
throw e; // rethrow
}
- return TokenNameSingleQuoteStringLiteral;
+ return TokenNameSingleQuoteStringLiteral;
}
protected boolean scanRegexCharacter() {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
index 61e3b3a721..d44dd97cad 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
@@ -15,6 +15,7 @@
package org.eclipse.jdt.internal.compiler.parser;
import org.eclipse.jdt.core.compiler.CharOperation;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
/**
* Javadoc tag constants.
@@ -180,97 +181,69 @@ public interface JavadocTagConstants {
// href tag
public final static char[] HREF_TAG = {'h', 'r', 'e', 'f'};
+
+ /**
+ * A record class representing additional tags to be made
+ * available at specific java version levels.
+ *
+ * This class is intended to prevent maintainers from having to add
+ * empty arrays for each new java version that is released.
+ */
+ record LevelTags(int level, char[][] tags) { }
+ /**
+ * Convert an array of LevelTags into the char[][][] structure that is currently used to
+ * discover the additional tags available at a given java version.
+ *
+ * @param input A LevelTags array representing additional tags available for each java version
+ * @return a char[][][] array representing newly available tags for all java class version
+ */
+ public static char[][][] levelTagsToChar3d(LevelTags[] input) {
+ int expectedLength = ClassFileConstants.MAJOR_LATEST_VERSION - ClassFileConstants.MAJOR_VERSION_0 + 1;
+ char[][][] ret = new char[expectedLength][][];
+ for( int i = 0; i < ret.length; i++ ) {
+ ret[i] = new char[][] {};
+ }
+ for( int i = 0; i < input.length; i++ ) {
+ int nextLevel = input[i].level - ClassFileConstants.MAJOR_VERSION_0;
+ ret[nextLevel] = input[i].tags;
+ }
+ return ret;
+ }
+
/*
* Tags versions
+ *
+ * Maintainers should add a new LevelTag only for versions in which new tags are made available
*/
- public static final char[][][] BLOCK_TAGS = {
- // since 1.0
- { TAG_AUTHOR, TAG_DEPRECATED, TAG_EXCEPTION, TAG_PARAM, TAG_RETURN, TAG_SEE, TAG_VERSION, TAG_CATEGORY /* 1.6 tag but put here as we support it for all compliances */ },
- // since 1.1
- { TAG_SINCE },
- // since 1.2
- { TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD , TAG_THROWS },
- // since 1.3
- {},
- // since 1.4
- {},
- // since 1.5
- {},
- // since 1.6
- {},
- // since 1.7
- {},
- // since 1.8
- {TAG_API_NOTE, TAG_IMPL_SPEC, TAG_IMPL_NOTE},
- // since 9
- { TAG_HIDDEN, TAG_USES, TAG_PROVIDES },
- // since 10
- {},
- // since 11
- {},
- // since 12
- {},
- // since 13
- {},
- // since 14
- {},
- // since 15
- {},
- // since 16
- {},
- // since 17
- {},
- // since 18
- {},
- // since 19
- {},
- // since 20
- {},
- };
- public static final char[][][] INLINE_TAGS = {
- // since 1.0
- {},
- // since 1.1
- {},
- // since 1.2
- { TAG_LINK },
- // since 1.3
- { TAG_DOC_ROOT },
- // since 1.4
- { TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE },
- // since 1.5
- { TAG_CODE, TAG_LITERAL },
- // since 1.6
- {},
- // since 1.7
- {},
- // since 1.8
- {},
- // since 9
- { TAG_INDEX },
- // since 10
- { TAG_SUMMARY },
- // since 11
- {},
- // since 12
- {TAG_SYSTEM_PROPERTY},
- // since 13
- {},
- // since 14
- {},
- // since 15
- {},
- // since 16
- {TAG_RETURN},
- // since 17
- {},
- // since 18
- { TAG_SNIPPET },
- // since 19
- {},
- // since 20
- {},
+ public static final LevelTags[] BLOCK_TAGS_RAW = {
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_0, new char[][]{ TAG_AUTHOR, TAG_DEPRECATED, TAG_EXCEPTION, TAG_PARAM, TAG_RETURN, TAG_SEE, TAG_VERSION, TAG_CATEGORY /* 1.6 tag but put here as we support it for all compliances */ }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_1_1, new char[][]{ TAG_SINCE }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_1_2, new char[][]{ TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD , TAG_THROWS }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_1_8, new char[][]{TAG_API_NOTE, TAG_IMPL_SPEC, TAG_IMPL_NOTE}),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_9, new char[][]{ TAG_HIDDEN, TAG_USES, TAG_PROVIDES })
};
+ public static final char[][][] BLOCK_TAGS = levelTagsToChar3d(BLOCK_TAGS_RAW);
+
+ /*
+ * Inline Tags versions
+ *
+ * Maintainers should add a new LevelTag only for versions in which new tags are made available
+ */
+ public static final LevelTags[] INLINE_TAGS_RAW = {
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_1_2, new char[][]{ TAG_LINK }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_1_3, new char[][]{ TAG_DOC_ROOT }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_1_4, new char[][]{ TAG_INHERITDOC, TAG_LINKPLAIN, TAG_VALUE }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_1_5, new char[][]{ TAG_CODE, TAG_LITERAL }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_9, new char[][]{ TAG_INDEX }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_10, new char[][]{ TAG_SUMMARY }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_12, new char[][]{ TAG_SYSTEM_PROPERTY }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_16, new char[][]{ TAG_RETURN }),
+ new LevelTags(ClassFileConstants.MAJOR_VERSION_18, new char[][]{ TAG_SNIPPET }),
+ };
+ public static final char[][][] INLINE_TAGS = levelTagsToChar3d(INLINE_TAGS_RAW);
+
+
+
public static final char[][][] IN_SNIPPET_TAGS = {
// since 18
{ TAG_HIGHLIGHT, TAG_REPLACE, TAG_LINK }
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 2b2ba1da4b..054cc4513b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -2950,9 +2950,6 @@ protected void consumeConditionalExpression(int op) {
this.expressionStack[this.expressionPtr + 1],
this.expressionStack[this.expressionPtr + 2]);
}
-/**
- * @param op
- */
protected void consumeConditionalExpressionWithName(int op) {
// ConditionalExpression ::= Name '?' Expression ':' ConditionalExpression
this.intPtr -= 2;//consume position of the question mark
@@ -3471,6 +3468,9 @@ protected void consumeEnhancedForStatementHeaderInitRecord(boolean hasModifiers)
this.intStack[this.intPtr--]);
pushOnAstStack(forEachWithPattern);
this.forStartPosition = 0;
+ if (recordPattern != null) {
+ problemReporter().illegalRecordPattern(recordPattern.sourceStart, recordPattern.sourceEnd);
+ }
}
protected void consumeEnhancedForStatementHeaderInit(boolean hasModifiers) {
TypeReference type;
@@ -4142,7 +4142,6 @@ protected void consumeEqualityExpression(int op) {
op);
}
/*
- * @param op
*/
protected void consumeEqualityExpressionWithName(int op) {
// EqualityExpression ::= Name '==' RelationalExpression
@@ -14771,6 +14770,12 @@ public boolean automatonWillShift(int token, int lastAction) {
return lastAction != ERROR_ACTION;
}
}
+
+@Override
+public boolean automatonWillShift(int token) {
+ return automatonWillShift(token, this.unstackedAct);
+}
+
@Override
public boolean isParsingJava14() {
return this.parsingJava14Plus;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java
index 712e86150c..149a0b1d45 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java
@@ -30,9 +30,9 @@ public class RecoveredAnnotation extends RecoveredElement {
public static final int SINGLE_MEMBER = 2;
private int kind;
- private int identifierPtr;
- private int identifierLengthPtr;
- private int sourceStart;
+ private final int identifierPtr;
+ private final int identifierLengthPtr;
+ private final int sourceStart;
public boolean hasPendingMemberValueName;
public int memberValuPairEqualEnd = -1;
public Annotation annotation;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 519fd0682e..0c285dfc80 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2022 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
@@ -122,7 +122,6 @@ public class Scanner implements TerminalTokens {
boolean breakPreviewAllowed = false;
/**
* The current context of the scanner w.r.t restricted keywords
- *
*/
enum ScanContext {
EXPECTING_KEYWORD, EXPECTING_IDENTIFIER, AFTER_REQUIRES, INACTIVE
@@ -213,7 +212,7 @@ enum ScanContext {
//Java 15 - first _ keyword appears
Map _Keywords = null;
- private CharDeduplication deduplication = CharDeduplication.getThreadLocalInstance();
+ private final CharDeduplication deduplication = CharDeduplication.getThreadLocalInstance();
public Scanner() {
this(false /*comment*/, false /*whitespace*/, false /*nls*/, ClassFileConstants.JDK1_3 /*sourceLevel*/, null/*taskTag*/, null/*taskPriorities*/, true /*taskCaseSensitive*/);
@@ -1038,16 +1037,17 @@ private final void consumeDigits(int radix, boolean expectingDigitFirst) throws
switch(consumeDigits0(radix, USING_UNDERSCORE, INVALID_POSITION, expectingDigitFirst)) {
case USING_UNDERSCORE :
if (this.sourceLevel < ClassFileConstants.JDK1_7) {
- throw new InvalidInputException(UNDERSCORES_IN_LITERALS_NOT_BELOW_17);
+ throw invalidUnderscoresInLiterals();
}
break;
case INVALID_POSITION :
if (this.sourceLevel < ClassFileConstants.JDK1_7) {
- throw new InvalidInputException(UNDERSCORES_IN_LITERALS_NOT_BELOW_17);
+ throw invalidUnderscoresInLiterals();
}
- throw new InvalidInputException(INVALID_UNDERSCORE);
+ throw invalidUnderscore();
}
}
+
private final int consumeDigits0(int radix, int usingUnderscore, int invalidPosition, boolean expectingDigitFirst) throws InvalidInputException {
int kind = 0;
if (getNextChar('_')) {
@@ -1370,20 +1370,20 @@ public int scanIdentifier() throws InvalidInputException {
boolean isJavaIdStart;
if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
if (this.complianceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
// Unicode 4 detection
char low = (char) getNextCharWithBoundChecks();
if (low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE) {
// illegal low surrogate
- throw new InvalidInputException(INVALID_LOW_SURROGATE);
+ throw invalidLowSurrogate();
}
isJavaIdStart = ScannerHelper.isJavaIdentifierStart(this.complianceLevel, c, low);
} else if (c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE) {
if (this.complianceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
- throw new InvalidInputException(INVALID_HIGH_SURROGATE);
+ throw invalidHighSurrogate();
} else {
// optimized case already checked
isJavaIdStart = ScannerHelper.isJavaIdentifierStart(this.complianceLevel, c);
@@ -1828,7 +1828,7 @@ protected int getNextToken0() throws InvalidInputException {
int firstTag = 0;
while ((this.currentCharacter != '/') || (!star)) {
if (this.currentPosition >= this.eofPosition) {
- throw new InvalidInputException(UNTERMINATED_COMMENT);
+ throw unterminatedComment();
}
if ((this.currentCharacter == '\r') || (this.currentCharacter == '\n')) {
if (this.recordLineSeparator) {
@@ -1881,7 +1881,7 @@ protected int getNextToken0() throws InvalidInputException {
}
} catch (IndexOutOfBoundsException e) {
this.currentPosition--;
- throw new InvalidInputException(UNTERMINATED_COMMENT);
+ throw unterminatedComment();
}
break;
}
@@ -1893,7 +1893,7 @@ protected int getNextToken0() throws InvalidInputException {
if (atEnd())
return TokenNameEOF;
//the atEnd may not be if source is only some part of a real (external) stream
- throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
+ throw invalidEof();
default :
char c = this.currentCharacter;
if (c < ScannerHelper.MAX_OBVIOUS) {
@@ -1908,21 +1908,21 @@ protected int getNextToken0() throws InvalidInputException {
boolean isJavaIdStart;
if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
if (this.complianceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
// Unicode 4 detection
char low = (char) getNextChar();
if (low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE) {
// illegal low surrogate
- throw new InvalidInputException(INVALID_LOW_SURROGATE);
+ throw invalidLowSurrogate();
}
isJavaIdStart = ScannerHelper.isJavaIdentifierStart(this.complianceLevel, c, low);
}
else if (c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE) {
if (this.complianceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
- throw new InvalidInputException(INVALID_HIGH_SURROGATE);
+ throw invalidHighSurrogate();
} else {
// optimized case already checked
isJavaIdStart = ScannerHelper.isJavaIdentifierStart(this.complianceLevel, c);
@@ -1950,7 +1950,7 @@ protected int processSingleQuotes(boolean checkIfUnicode) throws InvalidInputExc
{
int test;
if ((test = getNextChar('\n', '\r')) == 0) {
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
if (test > 0) {
// relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
@@ -1964,7 +1964,7 @@ protected int processSingleQuotes(boolean checkIfUnicode) throws InvalidInputExc
break;
}
}
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
}
if (getNextChar('\'')) {
@@ -1979,7 +1979,7 @@ protected int processSingleQuotes(boolean checkIfUnicode) throws InvalidInputExc
break;
}
}
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
if (getNextChar('\\')) {
if (this.unicodeAsBackSlash) {
@@ -2004,7 +2004,7 @@ protected int processSingleQuotes(boolean checkIfUnicode) throws InvalidInputExc
&& (this.source[this.currentPosition] == 'u');
} catch(IndexOutOfBoundsException e) {
this.currentPosition--;
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
if (checkIfUnicode) {
getNextUnicodeChar();
@@ -2027,7 +2027,7 @@ protected int processSingleQuotes(boolean checkIfUnicode) throws InvalidInputExc
break;
}
}
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
protected int scanForStringLiteral() throws InvalidInputException {
boolean isTextBlock = false;
@@ -2055,7 +2055,7 @@ protected int scanForStringLiteral() throws InvalidInputException {
while (this.currentCharacter != '"') {
if (this.currentPosition >= this.eofPosition) {
- throw new InvalidInputException(UNTERMINATED_STRING);
+ throw unterminatedString();
}
/**** \r and \n are not valid in string literals ****/
if ((this.currentCharacter == '\n') || (this.currentCharacter == '\r')) {
@@ -2078,13 +2078,13 @@ protected int scanForStringLiteral() throws InvalidInputException {
break;
}
if (this.currentCharacter == '\"') {
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
}
} else {
this.currentPosition--; // set current position on new line character
}
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
if (this.currentCharacter == '\\') {
if (this.unicodeAsBackSlash) {
@@ -2127,7 +2127,7 @@ protected int scanForStringLiteral() throws InvalidInputException {
}
} catch (IndexOutOfBoundsException e) {
this.currentPosition--;
- throw new InvalidInputException(UNTERMINATED_STRING);
+ throw unterminatedString();
} catch (InvalidInputException e) {
if (e.getMessage().equals(INVALID_ESCAPE)) {
// relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
@@ -2243,10 +2243,10 @@ protected int scanForTextBlock() throws InvalidInputException {
if (lastQuotePos > 0)
this.currentPosition = lastQuotePos;
this.currentPosition = (lastQuotePos > 0) ? lastQuotePos : this.startPosition + this.rawStart;
- throw new InvalidInputException(UNTERMINATED_TEXT_BLOCK);
+ throw unterminatedTextBlock();
} catch (IndexOutOfBoundsException e) {
this.currentPosition = (lastQuotePos > 0) ? lastQuotePos : this.startPosition + this.rawStart;
- throw new InvalidInputException(UNTERMINATED_TEXT_BLOCK);
+ throw unterminatedTextBlock();
}
}
public void getNextUnicodeChar()
@@ -2265,18 +2265,18 @@ public void getNextUnicodeChar()
this.currentPosition++;
if (this.currentPosition >= this.eofPosition) {
this.currentPosition--;
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
unicodeSize++;
}
} else {
this.currentPosition--;
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
if ((this.currentPosition + 4) > this.eofPosition) {
this.currentPosition += (this.eofPosition - this.currentPosition);
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c1 < 0
@@ -2286,7 +2286,7 @@ public void getNextUnicodeChar()
|| c3 < 0
|| (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c4 < 0){
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
this.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
//need the unicode buffer
@@ -2698,7 +2698,7 @@ public final void jumpOverMethodBody() {
boolean isJavaIdStart;
if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
if (this.complianceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
// Unicode 4 detection
char low = (char) getNextChar();
@@ -3095,7 +3095,7 @@ protected final void scanEscapeCharacter() throws InvalidInputException {
break;
case 's' :
if (this.sourceLevel < ClassFileConstants.JDK15) {
- throw new InvalidInputException(INVALID_ESCAPE);
+ throw invalidEscape();
}
this.currentCharacter = ' ';
break;
@@ -3136,12 +3136,13 @@ protected final void scanEscapeCharacter() throws InvalidInputException {
this.currentPosition--;
}
if (number > 255)
- throw new InvalidInputException(INVALID_ESCAPE);
+ throw invalidEscape();
this.currentCharacter = (char) number;
} else
- throw new InvalidInputException(INVALID_ESCAPE);
+ throw invalidEscape();
}
}
+
public int scanIdentifierOrKeywordWithBoundCheck() {
//test keywords
@@ -3989,7 +3990,7 @@ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
int end = this.currentPosition;
if (getNextChar('l', 'L') >= 0) {
if (end == start) {
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
}
return TokenNameLongLiteral;
} else if (getNextChar('.')) {
@@ -4001,9 +4002,9 @@ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
end = this.currentPosition;
if (hasNoDigitsBeforeDot && end == start) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
}
if (getNextChar('p', 'P') >= 0) { // consume next character
@@ -4031,50 +4032,50 @@ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
}
if (!ScannerHelper.isDigit(this.currentCharacter)) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
if (this.currentCharacter == '_') {
// wrongly place '_'
consumeDigits(10);
- throw new InvalidInputException(INVALID_UNDERSCORE);
+ throw invalidUnderscore();
}
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
}
consumeDigits(10);
if (getNextChar('f', 'F') >= 0) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
return TokenNameFloatingPointLiteral;
}
if (getNextChar('d', 'D') >= 0) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
return TokenNameDoubleLiteral;
}
if (getNextChar('l', 'L') >= 0) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
}
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
return TokenNameDoubleLiteral;
} else {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
}
} else if (getNextChar('p', 'P') >= 0) { // consume next character
if (end == start) { // Has no digits before exponent
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
}
this.unicodeAsBackSlash = false;
if (((this.currentCharacter = this.source[this.currentPosition++]) == '\\')
@@ -4100,41 +4101,41 @@ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
}
if (!ScannerHelper.isDigit(this.currentCharacter)) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
if (this.currentCharacter == '_') {
// wrongly place '_'
consumeDigits(10);
- throw new InvalidInputException(INVALID_UNDERSCORE);
+ throw invalidUnderscore();
}
- throw new InvalidInputException(INVALID_FLOAT);
+ throw invalidFloat();
}
consumeDigits(10);
if (getNextChar('f', 'F') >= 0) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
return TokenNameFloatingPointLiteral;
}
if (getNextChar('d', 'D') >= 0) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
return TokenNameDoubleLiteral;
}
if (getNextChar('l', 'L') >= 0) {
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
}
if (this.sourceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+ throw illegalHexaLiteral();
}
return TokenNameDoubleLiteral;
} else {
if (end == start)
- throw new InvalidInputException(INVALID_HEXA);
+ throw invalidHexa();
return TokenNameIntegerLiteral;
}
} else if (getNextChar('b', 'B') >= 0) { //----------binary-----------------
@@ -4143,18 +4144,18 @@ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
int end = this.currentPosition;
if (end == start) {
if (this.sourceLevel < ClassFileConstants.JDK1_7) {
- throw new InvalidInputException(BINARY_LITERAL_NOT_BELOW_17);
+ throw invalidBinaryLiteral();
}
- throw new InvalidInputException(INVALID_BINARY);
+ throw invalidBinary();
}
if (getNextChar('l', 'L') >= 0) {
if (this.sourceLevel < ClassFileConstants.JDK1_7) {
- throw new InvalidInputException(BINARY_LITERAL_NOT_BELOW_17);
+ throw invalidBinaryLiteral();
}
return TokenNameLongLiteral;
}
if (this.sourceLevel < ClassFileConstants.JDK1_7) {
- throw new InvalidInputException(BINARY_LITERAL_NOT_BELOW_17);
+ throw invalidBinaryLiteral();
}
return TokenNameIntegerLiteral;
}
@@ -4208,9 +4209,9 @@ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
if (this.currentCharacter == '_') {
// wrongly place '_'
consumeDigits(10);
- throw new InvalidInputException(INVALID_UNDERSCORE);
+ throw invalidUnderscore();
}
- throw new InvalidInputException(INVALID_FLOAT);
+ throw invalidFloat();
}
consumeDigits(10);
}
@@ -4266,9 +4267,9 @@ public int scanNumber(boolean dotPrefix) throws InvalidInputException {
if (this.currentCharacter == '_') {
// wrongly place '_'
consumeDigits(10);
- throw new InvalidInputException(INVALID_UNDERSCORE);
+ throw invalidUnderscore();
}
- throw new InvalidInputException(INVALID_FLOAT);
+ throw invalidFloat();
}
// current character is a digit so we expect no digit first (the next character could be an underscore)
consumeDigits(10);
@@ -4780,10 +4781,8 @@ private static class Goal {
static int BlockStatementoptRule = 0;
static int YieldStatementRule = 0;
static int SwitchLabelCaseLhsRule = 0;
- static int GuardRule = 0;
static int[] RestrictedIdentifierSealedRule;
static int[] RestrictedIdentifierPermitsRule;
- static int[] RestrictedIdentifierWhenRule;
static int[] PatternRules;
static int RecordPatternRule = 0;
@@ -4796,16 +4795,13 @@ private static class Goal {
static Goal SwitchLabelCaseLhsGoal;
static Goal RestrictedIdentifierSealedGoal;
static Goal RestrictedIdentifierPermitsGoal;
- static Goal RestrictedIdentifierWhenGoal;
static Goal PatternGoal;
static Goal RecordPatternGoal;
- static int[] EMPTY_FOLLOW_SET = new int[0];
static int[] RestrictedIdentifierSealedFollow = { TokenNameclass, TokenNameinterface,
TokenNameenum, TokenNameRestrictedIdentifierrecord };// Note: enum/record allowed as error flagging rules.
static int[] RestrictedIdentifierPermitsFollow = { TokenNameLBRACE };
static int[] PatternCaseLabelFollow = {TokenNameCOLON, TokenNameARROW, TokenNameCOMMA, TokenNameBeginCaseExpr, TokenNameRestrictedIdentifierWhen};
- static int[] GuardFollow = EMPTY_FOLLOW_SET;
static int[] RecordPatternFollow = {TokenNameCOLON}; // disambiguate only for enh for
static {
@@ -4854,10 +4850,7 @@ private static class Goal {
if ("RecordPattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) {//$NON-NLS-1$
patternStates.add(i);
RecordPatternRule = i;
- } else
- if ("Expression".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
- GuardRule = i;
-
+ }
}
RestrictedIdentifierSealedRule = ridSealed.stream().mapToInt(Integer :: intValue).toArray(); // overkill but future-proof
RestrictedIdentifierPermitsRule = ridPermits.stream().mapToInt(Integer :: intValue).toArray();
@@ -4872,7 +4865,6 @@ private static class Goal {
SwitchLabelCaseLhsGoal = new Goal(TokenNameARROW, new int [0], SwitchLabelCaseLhsRule);
RestrictedIdentifierSealedGoal = new Goal(TokenNameRestrictedIdentifiersealed, RestrictedIdentifierSealedFollow, RestrictedIdentifierSealedRule);
RestrictedIdentifierPermitsGoal = new Goal(TokenNameRestrictedIdentifierpermits, RestrictedIdentifierPermitsFollow, RestrictedIdentifierPermitsRule);
- RestrictedIdentifierWhenGoal = new Goal(TokenNameRestrictedIdentifierWhen, GuardFollow, GuardRule);
PatternGoal = new Goal(TokenNameBeginCaseElement, PatternCaseLabelFollow, PatternRules);
RecordPatternGoal = new Goal(TokenNameQUESTION, RecordPatternFollow, RecordPatternRule);
}
@@ -4985,6 +4977,11 @@ protected boolean parse(Goal goal) {
do { /* reduce */
if (goal.hasBeenReached(act, this.currentToken))
return SUCCESS;
+ if (this.currentToken == TokenNameIdentifier) {
+ int reskw = TerminalTokens.getRestrictedKeyword(this.scanner.getCurrentIdentifierSource());
+ if (reskw != TokenNameNotAToken && goal.hasBeenReached(act, reskw))
+ return SUCCESS;
+ }
this.stateStackTop -= (Parser.rhs[act] - 1);
act = Parser.ntAction(this.stack[this.stateStackTop], Parser.lhs[act]);
} while (act <= NUM_RULES);
@@ -5080,25 +5077,6 @@ protected final boolean mayBeAtCasePattern(int token) {
return (!isInModuleDeclaration() && JavaFeature.PATTERN_MATCHING_IN_SWITCH.isSupported(this.complianceLevel, this.previewEnabled))
&& (token == TokenNamecase || this.multiCaseLabelComma);
}
-protected boolean mayBeAtGuard(int token) {
- if (isInModuleDeclaration())
- return false;
- if (!JavaFeature.PATTERN_MATCHING_IN_SWITCH.isSupported(this.complianceLevel, this.previewEnabled))
- return false;
- /*
- * A simple elimination optimization for some common possible cases. According to the JLS 19 including
- * patterns-switch and record-patterns Section 14.30.1, a guard may only be preceded by either right parentheses or
- * an identifier. However, we may still encounter comments, whitespace or the not-a-token token.
- */
- switch (this.lookBack[1]) {
- case TokenNameRPAREN:
- case TokenNameIdentifier:
- case TokenNameNotAToken: // TODO is this useful? Some tests start scanning at "when", but this makes no sense as a Pattern is required by the JLS
- return true;
- }
- return false;
-}
-
protected final boolean maybeAtLambdaOrCast() { // Could the '(' we saw just now herald a lambda parameter list or a cast expression ? (the possible locations for both are identical.)
if (isInModuleDeclaration())
@@ -5112,6 +5090,7 @@ protected final boolean maybeAtLambdaOrCast() { // Could the '(' we saw just now
case TokenNameswitch:
case TokenNamewhile:
case TokenNamefor:
+ case TokenNamecase:
case TokenNamesynchronized:
case TokenNametry:
return false; // not a viable prefix for cast or lambda.
@@ -5407,8 +5386,8 @@ int disambiguatedRestrictedIdentifierWhen(int restrictedIdentifierToken) {
if (!JavaFeature.PATTERN_MATCHING_IN_SWITCH.isSupported(this.complianceLevel, this.previewEnabled))
return TokenNameIdentifier;
- return disambiguatesRestrictedIdentifierWithLookAhead(this::mayBeAtGuard,
- restrictedIdentifierToken, Goal.RestrictedIdentifierWhenGoal);
+ return this.activeParser == null || !this.activeParser.automatonWillShift(TokenNameRestrictedIdentifierWhen) ?
+ TokenNameIdentifier : TokenNameRestrictedIdentifierWhen;
}
int disambiguatedRestrictedIdentifierYield(int restrictedIdentifierToken) {
// and here's the kludge
@@ -5665,4 +5644,65 @@ We use FOLLOW rather than FIRST since we want to recognize empty statements. i.e
protected int getNextNotFakedToken() throws InvalidInputException {
return getNextToken();
}
+
+protected static InvalidInputException invalidCharacter() {
+ return new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+}
+protected static InvalidInputException invalidCharInString() {
+ return new InvalidInputException(INVALID_CHAR_IN_STRING);
+}
+protected static InvalidInputException unterminatedString() {
+ return new InvalidInputException(UNTERMINATED_STRING);
+}
+protected static InvalidInputException invalidUnicodeEscape() {
+ return new InvalidInputException(INVALID_UNICODE_ESCAPE);
+}
+protected static InvalidInputException invalidLowSurrogate() {
+ return new InvalidInputException(INVALID_LOW_SURROGATE);
+}
+protected static InvalidInputException invalidHighSurrogate() {
+ return new InvalidInputException(INVALID_HIGH_SURROGATE);
+}
+protected static InvalidInputException unterminatedComment() {
+ return new InvalidInputException(UNTERMINATED_COMMENT);
+}
+protected static InvalidInputException unterminatedTextBlock() {
+ return new InvalidInputException(UNTERMINATED_TEXT_BLOCK);
+}
+protected static InvalidInputException invalidEof() {
+ return new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
+}
+protected static InvalidInputException invalidUnderscore() {
+ return new InvalidInputException(INVALID_UNDERSCORE);
+}
+protected static InvalidInputException invalidUnderscoresInLiterals() {
+ return new InvalidInputException(UNDERSCORES_IN_LITERALS_NOT_BELOW_17);
+}
+protected static InvalidInputException invalidEscape() {
+ return new InvalidInputException(INVALID_ESCAPE);
+}
+protected static InvalidInputException invalidHexa() {
+ return new InvalidInputException(INVALID_HEXA);
+}
+protected static InvalidInputException illegalHexaLiteral() {
+ return new InvalidInputException(ILLEGAL_HEXA_LITERAL);
+}
+protected static InvalidInputException invalidFloat() {
+ return new InvalidInputException(INVALID_FLOAT);
+}
+protected static InvalidInputException invalidBinaryLiteral() {
+ return new InvalidInputException(BINARY_LITERAL_NOT_BELOW_17);
+}
+protected static InvalidInputException invalidBinary() {
+ return new InvalidInputException(INVALID_BINARY);
+}
+public static InvalidInputException invalidToken(int token) {
+ return new InvalidInputException("Unknown token (check Scanner/TerminalTokens): " + token); //$NON-NLS-1$
+}
+public static InvalidInputException invalidInput() {
+ return new InvalidInputException();
+}
+
+
+
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
index c09d815b10..c716f1d6e7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
@@ -38,6 +38,38 @@ public interface TerminalTokens {
TokenNameCOMMENT_JAVADOC = 1003,
TokenNameSingleQuoteStringLiteral = 1004;
+ static boolean isRestrictedKeyword(int tokenType) {
+ return switch (tokenType) {
+ case TokenNameRestrictedIdentifierYield, TokenNameRestrictedIdentifierrecord,TokenNameRestrictedIdentifierWhen,
+ TokenNameRestrictedIdentifiersealed, TokenNameRestrictedIdentifierpermits -> true;
+ default -> false;
+ };
+ }
+
+ static int getRestrictedKeyword(char [] text) {
+ if (text != null) {
+ int len = text.length;
+ if (len == 4 && text[0] == 'w' ||
+ len == 5 && text[0] == 'y' ||
+ len == 6 && (text[0] == 'r' || text[0] == 's') ||
+ len == 7 && text[0] == 'p') {
+ return getRestrictedKeyword(new String(text));
+ }
+ }
+ return TokenNameNotAToken;
+ }
+
+ static int getRestrictedKeyword(String text) {
+ return switch (text) {
+ case "yield" -> TokenNameRestrictedIdentifierYield; //$NON-NLS-1$
+ case "record" -> TokenNameRestrictedIdentifierrecord; //$NON-NLS-1$
+ case "when" -> TokenNameRestrictedIdentifierWhen; //$NON-NLS-1$
+ case "sealed" -> TokenNameRestrictedIdentifiersealed; //$NON-NLS-1$
+ case "permits" -> TokenNameRestrictedIdentifierpermits; //$NON-NLS-1$
+ default -> TokenNameNotAToken;
+ };
+ }
+
// BEGIN_AUTOGENERATED_REGION
int TokenNameIdentifier = 19,
TokenNameabstract = 42,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
index 64220a34f2..15b95434af 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
@@ -28,7 +28,7 @@
public class DiagnoseParser implements ParserBasicInformation, TerminalTokens, ConflictedParser {
private static final boolean DEBUG = false;
- private boolean DEBUG_PARSECHECK = false;
+ private final boolean DEBUG_PARSECHECK = false;
private static final int STACK_INCREMENT = 256;
@@ -49,9 +49,9 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens, C
private static final int MAX_DISTANCE = 30;
private static final int MIN_DISTANCE = 3;
- private CompilerOptions options;
+ private final CompilerOptions options;
- private LexStream lexStream;
+ private final LexStream lexStream;
private int errorToken;
private int errorTokenStart;
@@ -85,9 +85,9 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens, C
int statePoolTop;
StateInfo[] statePool;
- private Parser parser;
+ private final Parser parser;
- private RecoveryScanner recoveryScanner;
+ private final RecoveryScanner recoveryScanner;
private boolean reportProblem;
private int deferredErrorStart;
@@ -198,12 +198,14 @@ public void diagnoseParse(boolean record) {
this.deferredErrorStart = this.deferredErrorEnd = -1;
diagnoseParse0(record);
} finally {
- ReferenceContext referenceContext = this.problemReporter().referenceContext;
- CompilationResult compilationResult = referenceContext != null ? referenceContext.compilationResult() : null;
- if (compilationResult != null && !compilationResult.hasSyntaxError) {
- reportMisplacedConstruct(this.deferredErrorStart, this.deferredErrorEnd, true);
+ try (ProblemReporter problemReporter = this.problemReporter()) {
+ ReferenceContext referenceContext = problemReporter.referenceContext;
+ CompilationResult compilationResult = referenceContext != null ? referenceContext.compilationResult() : null;
+ if (compilationResult != null && !compilationResult.hasSyntaxError) {
+ reportMisplacedConstruct(this.deferredErrorStart, this.deferredErrorEnd, true);
+ }
+ this.deferredErrorStart = this.deferredErrorEnd = -1;
}
- this.deferredErrorStart = this.deferredErrorEnd = -1;
}
}
@@ -404,9 +406,11 @@ private void diagnoseParse0(boolean record) {
return;
}
- if(this.parser.problemReporter().options.maxProblemsPerUnit < this.parser.compilationUnit.compilationResult.problemCount) {
- if(this.recoveryScanner == null || !this.recoveryScanner.record) return;
- this.reportProblem = false;
+ try (ProblemReporter problemReporter = this.parser.problemReporter()) {
+ if(problemReporter.options.maxProblemsPerUnit < this.parser.compilationUnit.compilationResult.problemCount) {
+ if(this.recoveryScanner == null || !this.recoveryScanner.record) return;
+ this.reportProblem = false;
+ }
}
act = this.stack[this.stateStackTop];
@@ -2611,6 +2615,11 @@ public boolean atConflictScenario(int token) {
return (token == TokenNameLPAREN || token == TokenNameAT || (token == TokenNameLESS && !this.lexStream.awaitingColonColon()));
}
+ @Override
+ public boolean automatonWillShift(int token) {
+ return false; // Some day we will understand the world well enough, for now say no and deal with it (sigh)
+ }
+
@Override
public boolean isParsingModuleDeclaration() {
//
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/LexStream.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/LexStream.java
index d0845a6f58..3cb1a959b5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/LexStream.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/diagnose/LexStream.java
@@ -43,14 +43,14 @@ public String toString() {
private int tokenCacheIndex;
private int tokenCacheEOFIndex;
- private Token[] tokenCache;
+ private final Token[] tokenCache;
private int currentIndex = -1;
- private Scanner scanner;
- private int[] intervalStartToSkip;
- private int[] intervalEndToSkip;
- private int[] intervalFlagsToSkip;
+ private final Scanner scanner;
+ private final int[] intervalStartToSkip;
+ private final int[] intervalEndToSkip;
+ private final int[] intervalFlagsToSkip;
private int previousInterval = -1;
private int currentInterval = -1;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java
index 24ebdb312a..03a9a6673e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java
@@ -21,14 +21,14 @@
public class DefaultProblem extends CategorizedProblem {
private char[] fileName;
- private int id;
+ private final int id;
private int startPosition;
private int endPosition;
private int line;
public int column;
public int severity;
- private String[] arguments;
- private String message;
+ private final String[] arguments;
+ private final String message;
// cannot directly point to IJavaModelMarker constants from within batch compiler
private static final String MARKER_TYPE_PROBLEM = "org.eclipse.jdt.core.problem"; //$NON-NLS-1$
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
index 7dc5c372be..1f86557844 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
@@ -53,7 +53,6 @@ public class ProblemHandler {
* Problem handler can be supplied with a policy to specify
* its behavior in error handling. Also see static methods for
* built-in policies.
- *
*/
public ProblemHandler(IErrorHandlingPolicy policy, CompilerOptions options, IProblemFactory problemFactory) {
this.policy = policy;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index cd954a2f8a..5b13e1a7c3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -221,8 +221,9 @@
import org.eclipse.jdt.internal.compiler.util.Messages;
import org.eclipse.jdt.internal.compiler.util.Util;
+/** See contract of {@link #close()}. */
@SuppressWarnings("rawtypes")
-public class ProblemReporter extends ProblemHandler {
+public class ProblemReporter extends ProblemHandler implements AutoCloseable {
public ReferenceContext referenceContext;
private Scanner positionScanner;
@@ -732,7 +733,6 @@ public static int getIrritant(int problemID) {
}
/**
* Compute problem category ID based on problem ID
- * @param problemID
* @return a category ID
* @see CategorizedProblem
*/
@@ -1971,6 +1971,8 @@ public void deprecatedType(TypeBinding type, ASTNode location) {
public void deprecatedType(TypeBinding type, ASTNode location, int index) {
if (location == null) return; // 1G828DN - no type ref for synthetic arguments
final TypeBinding leafType = type.leafComponentType();
+ if (!leafType.isReadyForAnnotations() && scheduleProblemForContext(() -> deprecatedType(type, location, index)))
+ return;
int sourceStart = -1;
if (location instanceof QualifiedTypeReference) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=300031
QualifiedTypeReference ref = (QualifiedTypeReference) location;
@@ -2028,7 +2030,7 @@ String deprecatedSinceValue(Supplier annotations) {
}
}
} finally {
- this.referenceContext = contextSave;
+ this.referenceContext = contextSave; // resolving could have manipulated the referenceContext
}
}
return null;
@@ -4901,130 +4903,132 @@ public void invalidParenthesizedExpression(ASTNode reference) {
reference.sourceEnd);
}
public void invalidType(ASTNode location, TypeBinding type) {
- if (type instanceof ReferenceBinding) {
- if (isRecoveredName(((ReferenceBinding)type).compoundName)) return;
- }
- else if (type instanceof ArrayBinding) {
- TypeBinding leafType = ((ArrayBinding)type).leafComponentType;
- if (leafType instanceof ReferenceBinding) {
- if (isRecoveredName(((ReferenceBinding)leafType).compoundName)) return;
+ try (this) { // ensure clean-up despite the many exits without calling handle(..)
+ if (type instanceof ReferenceBinding) {
+ if (isRecoveredName(((ReferenceBinding)type).compoundName)) return;
+ }
+ else if (type instanceof ArrayBinding) {
+ TypeBinding leafType = ((ArrayBinding)type).leafComponentType;
+ if (leafType instanceof ReferenceBinding) {
+ if (isRecoveredName(((ReferenceBinding)leafType).compoundName)) return;
+ }
}
- }
- if (type.isParameterizedType()) {
- List missingTypes = type.collectMissingTypes(null);
- if (missingTypes != null) {
- ReferenceContext savedContext = this.referenceContext;
- for (Iterator iterator = missingTypes.iterator(); iterator.hasNext(); ) {
- try {
- invalidType(location, (TypeBinding) iterator.next());
- } finally {
- this.referenceContext = savedContext;
+ if (type.isParameterizedType()) {
+ List missingTypes = type.collectMissingTypes(null);
+ if (missingTypes != null) {
+ ReferenceContext savedContext = this.referenceContext;
+ for (Iterator iterator = missingTypes.iterator(); iterator.hasNext(); ) {
+ try {
+ invalidType(location, (TypeBinding) iterator.next());
+ } finally {
+ this.referenceContext = savedContext; // nested reporting will have reset referenceContext
+ }
}
+ return;
}
- return;
}
- }
- int id = IProblem.UndefinedType; // default
- switch (type.problemId()) {
- case ProblemReasons.NotFound :
- id = IProblem.UndefinedType;
- break;
- case ProblemReasons.NotVisible :
- id = IProblem.NotVisibleType;
- break;
- case ProblemReasons.NotAccessible :
- id = IProblem.NotAccessibleType;
- break;
- case ProblemReasons.Ambiguous :
- id = IProblem.AmbiguousType;
- break;
- case ProblemReasons.InternalNameProvided :
- id = IProblem.InternalTypeNameProvided;
- break;
- case ProblemReasons.InheritedNameHidesEnclosingName :
- id = IProblem.InheritedTypeHidesEnclosingName;
- break;
- case ProblemReasons.NonStaticReferenceInStaticContext :
- id = IProblem.NonStaticTypeFromStaticInvocation;
- break;
- case ProblemReasons.IllegalSuperTypeVariable :
- id = IProblem.IllegalTypeVariableSuperReference;
- break;
- case ProblemReasons.NoError : // 0
- default :
- needImplementation(location); // want to fail to see why we were here...
- break;
- }
+ int id = IProblem.UndefinedType; // default
+ switch (type.problemId()) {
+ case ProblemReasons.NotFound :
+ id = IProblem.UndefinedType;
+ break;
+ case ProblemReasons.NotVisible :
+ id = IProblem.NotVisibleType;
+ break;
+ case ProblemReasons.NotAccessible :
+ id = IProblem.NotAccessibleType;
+ break;
+ case ProblemReasons.Ambiguous :
+ id = IProblem.AmbiguousType;
+ break;
+ case ProblemReasons.InternalNameProvided :
+ id = IProblem.InternalTypeNameProvided;
+ break;
+ case ProblemReasons.InheritedNameHidesEnclosingName :
+ id = IProblem.InheritedTypeHidesEnclosingName;
+ break;
+ case ProblemReasons.NonStaticReferenceInStaticContext :
+ id = IProblem.NonStaticTypeFromStaticInvocation;
+ break;
+ case ProblemReasons.IllegalSuperTypeVariable :
+ id = IProblem.IllegalTypeVariableSuperReference;
+ break;
+ case ProblemReasons.NoError : // 0
+ default :
+ needImplementation(location); // want to fail to see why we were here...
+ break;
+ }
- int end = location.sourceEnd;
- if (location instanceof QualifiedNameReference) {
- QualifiedNameReference ref = (QualifiedNameReference) location;
- if (isRecoveredName(ref.tokens)) return;
- if (ref.indexOfFirstFieldBinding >= 1)
- end = (int) ref.sourcePositions[ref.indexOfFirstFieldBinding - 1];
- } else if (location instanceof ParameterizedQualifiedTypeReference) {
- // must be before instanceof ArrayQualifiedTypeReference
- ParameterizedQualifiedTypeReference ref = (ParameterizedQualifiedTypeReference) location;
- if (isRecoveredName(ref.tokens)) return;
- if (type instanceof ReferenceBinding) {
- char[][] name = ((ReferenceBinding) type).compoundName;
- if (name.length <= ref.sourcePositions.length) {
- end = (int) ref.sourcePositions[name.length - 1];
+ int end = location.sourceEnd;
+ if (location instanceof QualifiedNameReference) {
+ QualifiedNameReference ref = (QualifiedNameReference) location;
+ if (isRecoveredName(ref.tokens)) return;
+ if (ref.indexOfFirstFieldBinding >= 1)
+ end = (int) ref.sourcePositions[ref.indexOfFirstFieldBinding - 1];
+ } else if (location instanceof ParameterizedQualifiedTypeReference) {
+ // must be before instanceof ArrayQualifiedTypeReference
+ ParameterizedQualifiedTypeReference ref = (ParameterizedQualifiedTypeReference) location;
+ if (isRecoveredName(ref.tokens)) return;
+ if (type instanceof ReferenceBinding) {
+ char[][] name = ((ReferenceBinding) type).compoundName;
+ if (name.length <= ref.sourcePositions.length) {
+ end = (int) ref.sourcePositions[name.length - 1];
+ }
}
- }
- } else if (location instanceof ArrayQualifiedTypeReference) {
- ArrayQualifiedTypeReference arrayQualifiedTypeReference = (ArrayQualifiedTypeReference) location;
- if (isRecoveredName(arrayQualifiedTypeReference.tokens)) return;
- TypeBinding leafType = type.leafComponentType();
- if (leafType instanceof ReferenceBinding) {
- char[][] name = ((ReferenceBinding) leafType).compoundName; // problem type will tell how much got resolved
- if (name.length <= arrayQualifiedTypeReference.sourcePositions.length) {
- end = (int) arrayQualifiedTypeReference.sourcePositions[name.length-1];
+ } else if (location instanceof ArrayQualifiedTypeReference) {
+ ArrayQualifiedTypeReference arrayQualifiedTypeReference = (ArrayQualifiedTypeReference) location;
+ if (isRecoveredName(arrayQualifiedTypeReference.tokens)) return;
+ TypeBinding leafType = type.leafComponentType();
+ if (leafType instanceof ReferenceBinding) {
+ char[][] name = ((ReferenceBinding) leafType).compoundName; // problem type will tell how much got resolved
+ if (name.length <= arrayQualifiedTypeReference.sourcePositions.length) {
+ end = (int) arrayQualifiedTypeReference.sourcePositions[name.length-1];
+ }
+ } else {
+ long[] positions = arrayQualifiedTypeReference.sourcePositions;
+ end = (int) positions[positions.length - 1];
}
- } else {
- long[] positions = arrayQualifiedTypeReference.sourcePositions;
- end = (int) positions[positions.length - 1];
- }
- } else if (location instanceof QualifiedTypeReference) {
- QualifiedTypeReference ref = (QualifiedTypeReference) location;
- if (isRecoveredName(ref.tokens)) return;
- if (type instanceof ReferenceBinding) {
- char[][] name = ((ReferenceBinding) type).compoundName;
- if (name.length <= ref.sourcePositions.length)
+ } else if (location instanceof QualifiedTypeReference) {
+ QualifiedTypeReference ref = (QualifiedTypeReference) location;
+ if (isRecoveredName(ref.tokens)) return;
+ if (type instanceof ReferenceBinding) {
+ char[][] name = ((ReferenceBinding) type).compoundName;
+ if (name.length <= ref.sourcePositions.length)
+ end = (int) ref.sourcePositions[name.length - 1];
+ }
+ } else if (location instanceof ImportReference) {
+ ImportReference ref = (ImportReference) location;
+ if (isRecoveredName(ref.tokens)) return;
+ if (type instanceof ReferenceBinding) {
+ char[][] name = ((ReferenceBinding) type).compoundName;
end = (int) ref.sourcePositions[name.length - 1];
+ }
+ } else if (location instanceof ArrayTypeReference) {
+ ArrayTypeReference arrayTypeReference = (ArrayTypeReference) location;
+ if (isRecoveredName(arrayTypeReference.token)) return;
+ end = arrayTypeReference.originalSourceEnd;
}
- } else if (location instanceof ImportReference) {
- ImportReference ref = (ImportReference) location;
- if (isRecoveredName(ref.tokens)) return;
- if (type instanceof ReferenceBinding) {
- char[][] name = ((ReferenceBinding) type).compoundName;
- end = (int) ref.sourcePositions[name.length - 1];
+
+ int start = location.sourceStart;
+ if (location instanceof org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) {
+ org.eclipse.jdt.internal.compiler.ast.SingleTypeReference ref =
+ (org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) location;
+ if (ref.annotations != null)
+ start = end - ref.token.length + 1;
+ } else if (location instanceof QualifiedTypeReference) {
+ QualifiedTypeReference ref = (QualifiedTypeReference) location;
+ if (ref.annotations != null)
+ start = (int) (ref.sourcePositions[0] & 0x00000000FFFFFFFFL ) - ref.tokens[0].length + 1;
}
- } else if (location instanceof ArrayTypeReference) {
- ArrayTypeReference arrayTypeReference = (ArrayTypeReference) location;
- if (isRecoveredName(arrayTypeReference.token)) return;
- end = arrayTypeReference.originalSourceEnd;
- }
- int start = location.sourceStart;
- if (location instanceof org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) {
- org.eclipse.jdt.internal.compiler.ast.SingleTypeReference ref =
- (org.eclipse.jdt.internal.compiler.ast.SingleTypeReference) location;
- if (ref.annotations != null)
- start = end - ref.token.length + 1;
- } else if (location instanceof QualifiedTypeReference) {
- QualifiedTypeReference ref = (QualifiedTypeReference) location;
- if (ref.annotations != null)
- start = (int) (ref.sourcePositions[0] & 0x00000000FFFFFFFFL ) - ref.tokens[0].length + 1;
+ this.handle(
+ id,
+ new String[] {new String(type.leafComponentType().readableName()) },
+ new String[] {new String(type.leafComponentType().shortReadableName())},
+ start,
+ end);
}
-
- this.handle(
- id,
- new String[] {new String(type.leafComponentType().readableName()) },
- new String[] {new String(type.leafComponentType().shortReadableName())},
- start,
- end);
}
public void invalidTypeForCollection(Expression expression) {
this.handle(
@@ -8511,7 +8515,14 @@ private boolean handleSyntaxErrorOnNewTokens(
String errorTokenName,
String expectedToken) {
if (isIdentifier(currentKind)) {
- return validateRestrictedKeywords(errorTokenSource, expectedToken, start, end, true);
+ if (expectedToken != null) {
+ String tokenName= new String(errorTokenSource);
+ String restrictedIdentifier= permittedRestrictedKeyWordMap.get(tokenName);
+ if (restrictedIdentifier == null || !restrictedIdentifier.equals(expectedToken)) {
+ return false;
+ }
+ }
+ return validateRestrictedKeywords(errorTokenSource, start, end, true);
}
return false;
}
@@ -9811,18 +9822,8 @@ public void previewAPIUsed(int sourceStart, int sourceEnd, boolean isFatal) {
sourceEnd);
}
//Returns true if the problem is handled and reported (only errors considered and not warnings)
-public boolean validateRestrictedKeywords(char[] name, int start, int end, boolean reportSyntaxError) {
- return validateRestrictedKeywords(name, null, start, end, reportSyntaxError);
-}
-private boolean validateRestrictedKeywords(char[] name, String expectedToken, int start, int end, boolean reportSyntaxError) {
+private boolean validateRestrictedKeywords(char[] name, int start, int end, boolean reportSyntaxError) {
boolean isPreviewEnabled = this.options.enablePreviewFeatures;
- if (expectedToken != null) {
- String tokenName= new String(name);
- String restrictedIdentifier= permittedRestrictedKeyWordMap.get(tokenName);
- if (restrictedIdentifier == null || !restrictedIdentifier.equals(expectedToken)) {
- return false;
- }
- }
for (JavaFeature feature : JavaFeature.values()) {
char[][] restrictedKeywords = feature.getRestrictedKeywords();
for (char[] k : restrictedKeywords) {
@@ -9854,7 +9855,10 @@ private boolean validateRestrictedKeywords(char[] name, String expectedToken, in
return false;
}
public boolean validateRestrictedKeywords(char[] name, ASTNode node) {
- return validateRestrictedKeywords(name, node.sourceStart, node.sourceEnd, false);
+ // ensure clean-up because inner method is not guaranteed to invoke handle(..)
+ try (this) {
+ return validateRestrictedKeywords(name, node.sourceStart, node.sourceEnd, false);
+ }
}
//Returns true if the problem is handled and reported (only errors considered and not warnings)
public boolean validateJavaFeatureSupport(JavaFeature feature, int sourceStart, int sourceEnd) {
@@ -11744,7 +11748,7 @@ public void conflictingPackageInModules(char[][] wellKnownTypeName, CompilationU
start,
end);
} finally {
- this.referenceContext = savedContext;
+ this.referenceContext = savedContext; // unsure from which phase we are called, so better to reset to previous
}
}
@@ -12560,6 +12564,14 @@ public void cannotInferRecordPatternTypes(RecordPattern pattern) {
pattern.sourceStart,
pattern.sourceEnd);
}
+public void illegalRecordPattern(int recordPatternSourceStart, int recordPatternSourceEnd) {
+ this.handle(
+ IProblem.IllegalRecordPattern,
+ NoArgument,
+ NoArgument,
+ recordPatternSourceStart,
+ recordPatternSourceEnd);
+}
public void falseLiteralInGuard(Expression exp) {
this.handle(
IProblem.FalseConstantInGuard,
@@ -12568,4 +12580,40 @@ public void falseLiteralInGuard(Expression exp) {
exp.sourceStart,
exp.sourceEnd);
}
-}
\ No newline at end of file
+public boolean scheduleProblemForContext(Runnable problemComputation) {
+ if (this.referenceContext != null) {
+ CompilationResult result = this.referenceContext.compilationResult();
+ if (result != null) {
+ try (this) {
+ ReferenceContext capturedContext = this.referenceContext;
+ result.scheduleProblem(() -> {
+ ReferenceContext save = this.referenceContext;
+ this.referenceContext = capturedContext;
+ try {
+ problemComputation.run();
+ } finally {
+ this.referenceContext = save;
+ }
+ });
+ }
+ return true;
+ }
+ }
+ return false;
+}
+/**
+ * General strategy:
+ *
+ *
clients are responsible for assigning {@link #referenceContext} prior to invoking any
+ * reporting method (usually, by obtaining an instance using {@link Scope#problemReporter()}).
+ *
individual methods should ensure that {@link #referenceContext} is reset to {@code null} afterwards. This may
+ * happen in two ways:
+ *
by calling any of the {@code handle(..)} methods on all paths, or failing that
+ *
wrap their body in {@code try(this) { ... }}.
+ *
+ */
+@Override
+public void close() {
+ this.referenceContext = null;
+}
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties
index 8241af0c58..fbb7c33afa 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -1153,6 +1153,8 @@
1914 = Record component with type {0} is not compatible with type {1}
1916 = A case label guard cannot have a constant expression with value as 'false'
1940 = Cannot infer record pattern types for {0}
+1941 = Syntax error, record patterns are not allowed here
+
1990 = Access to {1}({2}) from the type {0} is emulated by a synthetic accessor method
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseDiagnostic.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseDiagnostic.java
index ff748af1f5..26aa09be1e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseDiagnostic.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseDiagnostic.java
@@ -25,7 +25,7 @@
public class EclipseDiagnostic implements Diagnostic {
- private Kind kind;
+ private final Kind kind;
private final int problemId;
private final String[] problemArguments;
private final char[] originatingFileName;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java
index c70520f7de..c870341251 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java
@@ -46,7 +46,7 @@
*/
public class EclipseFileObject extends SimpleJavaFileObject {
File f;
- private Charset charset;
+ private final Charset charset;
private boolean parentsExist; // parent directories exist
public EclipseFileObject(String className, URI uri, Kind kind, Charset charset) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java
index 2470b93ed7..af6e2e0ce9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java
@@ -38,8 +38,8 @@
*/
public class PathFileObject implements JavaFileObject {
Path path;
- private Charset charset;
- private Kind kind;
+ private final Charset charset;
+ private final Kind kind;
public PathFileObject(Path path, Kind kind, Charset charset) {
this.path = path;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/Util.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/Util.java
index 203b28370d..fe016d904a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/Util.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/Util.java
@@ -29,7 +29,6 @@
/**
* Util class that defines helper methods to read class contents with handling of wrong encoding
- *
*/
public final class Util {
public static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/CtSym.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/CtSym.java
index e585215ea5..a496b1de18 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/CtSym.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/CtSym.java
@@ -225,7 +225,6 @@ public List releaseRoots(String releaseCode) {
*
* @param releaseCode release number encoded (7,8,9,A,B...)
* @param qualifiedSignatureFileName signature file name (without module)
- * @param moduleName
* @return corresponding path in ct.sym file system or null if not found
*/
public Path getFullPath(String releaseCode, String qualifiedSignatureFileName, String moduleName) {
@@ -458,4 +457,4 @@ public static String getReleaseCode(String release) {
return String.valueOf((char) ('A' + (numericVersion - 10)));
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java
index 44156e6579..86299cb1f7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java
@@ -58,7 +58,7 @@ private static String getReplacement(char c) {
}
return null;
}
- private String lineSeparator;
+ private final String lineSeparator;
private int tab;
public GenericXMLWriter(OutputStream stream, String lineSeparator, boolean printXmlVersion) {
this(new PrintWriter(stream), lineSeparator, printXmlVersion);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java
index 2633884a0f..1976b30c50 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java
@@ -13,12 +13,14 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.util;
+import java.util.Arrays;
+
import org.eclipse.jdt.core.compiler.CharOperation;
/**
* Hashtable of {char[] --> Object }
*/
-public final class HashtableOfObject implements Cloneable {
+public final class HashtableOfObject {
/** Max array size accepted by JVM */
public static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 2;
@@ -28,7 +30,7 @@ public final class HashtableOfObject implements Cloneable {
public Object valueTable[];
public int elementSize; // number of elements in the table
- int threshold;
+ private int threshold;
public HashtableOfObject() {
this(13);
@@ -43,7 +45,6 @@ public HashtableOfObject(int size) {
if (size < 0) {
throw new NegativeArraySizeException("Bad attempt to create table with " + size + " elements"); //$NON-NLS-1$ //$NON-NLS-2$
}
- this.elementSize = 0;
this.threshold = size; // size represents the expected number of elements
int extraRoom = (int) (size * 1.75f);
if (this.threshold == extraRoom) {
@@ -58,37 +59,20 @@ public HashtableOfObject(int size) {
}
public void clear() {
- for (int i = this.keyTable.length; --i >= 0;) {
- this.keyTable[i] = null;
- this.valueTable[i] = null;
- }
+ Arrays.fill(this.keyTable, null);
+ Arrays.fill(this.valueTable, null);
this.elementSize = 0;
}
- @Override
- public Object clone() throws CloneNotSupportedException {
- HashtableOfObject result = (HashtableOfObject) super.clone();
- result.elementSize = this.elementSize;
- result.threshold = this.threshold;
-
+ public boolean containsKey(char[] key) {
int length = this.keyTable.length;
- result.keyTable = new char[length][];
- System.arraycopy(this.keyTable, 0, result.keyTable, 0, length);
-
- length = this.valueTable.length;
- result.valueTable = new Object[length];
- System.arraycopy(this.valueTable, 0, result.valueTable, 0, length);
- return result;
- }
+ int index = CharOperation.hashCode(key) % length;
- public boolean containsKey(char[] key) {
- int length = this.keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
char[] currentKey;
while ((currentKey = this.keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
+ if (CharOperation.equals(currentKey, key)) {
return true;
+ }
if (++index == length) {
index = 0;
}
@@ -97,13 +81,13 @@ public boolean containsKey(char[] key) {
}
public Object get(char[] key) {
- int length = this.keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
+ int length = this.keyTable.length;
+ int index = CharOperation.hashCode(key) % length;
char[] currentKey;
while ((currentKey = this.keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
+ if (CharOperation.equals(currentKey, key)) {
return this.valueTable[index];
+ }
if (++index == length) {
index = 0;
}
@@ -112,13 +96,13 @@ public Object get(char[] key) {
}
public Object put(char[] key, Object value) {
- int length = this.keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
+ int length = this.keyTable.length;
+ int index = CharOperation.hashCode(key) % length;
char[] currentKey;
while ((currentKey = this.keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key))
+ if (CharOperation.equals(currentKey, key)) {
return this.valueTable[index] = value;
+ }
if (++index == length) {
index = 0;
}
@@ -127,8 +111,9 @@ public Object put(char[] key, Object value) {
this.valueTable[index] = value;
// assumes the threshold is never equal to the size of the table
- if (++this.elementSize > this.threshold)
+ if (++this.elementSize > this.threshold) {
rehash();
+ }
return value;
}
@@ -142,8 +127,8 @@ public Object put(char[] key, Object value) {
* @param value The value of the table entry
*/
public void putUnsafely(char[] key, Object value) {
- int length = this.keyTable.length,
- index = CharOperation.hashCode(key) % length;
+ int length = this.keyTable.length;
+ int index = CharOperation.hashCode(key) % length;
while (this.keyTable[index] != null) {
if (++index == length) {
index = 0;
@@ -158,34 +143,15 @@ public void putUnsafely(char[] key, Object value) {
}
}
- public Object removeKey(char[] key) {
- int length = this.keyTable.length,
- index = CharOperation.hashCode(key) % length;
- int keyLength = key.length;
- char[] currentKey;
- while ((currentKey = this.keyTable[index]) != null) {
- if (currentKey.length == keyLength && CharOperation.equals(currentKey, key)) {
- Object value = this.valueTable[index];
- this.elementSize--;
- this.keyTable[index] = null;
- this.valueTable[index] = null;
- rehash();
- return value;
- }
- if (++index == length) {
- index = 0;
- }
- }
- return null;
- }
-
private void rehash() {
int newSize = calculateNewSize(this.elementSize);
HashtableOfObject newHashtable = new HashtableOfObject(newSize);
char[] currentKey;
- for (int i = this.keyTable.length; --i >= 0;)
- if ((currentKey = this.keyTable[i]) != null)
+ for (int i = this.keyTable.length; --i >= 0;) {
+ if ((currentKey = this.keyTable[i]) != null) {
newHashtable.putUnsafely(currentKey, this.valueTable[i]);
+ }
+ }
this.keyTable = newHashtable.keyTable;
this.valueTable = newHashtable.valueTable;
@@ -236,9 +202,11 @@ public int size() {
public String toString() {
String s = ""; //$NON-NLS-1$
Object object;
- for (int i = 0, length = this.valueTable.length; i < length; i++)
- if ((object = this.valueTable[i]) != null)
+ for (int i = 0, length = this.valueTable.length; i < length; i++) {
+ if ((object = this.valueTable[i]) != null) {
s += new String(this.keyTable[i]) + " -> " + object.toString() + "\n"; //$NON-NLS-2$ //$NON-NLS-1$
+ }
+ }
return s;
}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/JRTUtil.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/JRTUtil.java
index 8fce764e61..ed4bf4a463 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/JRTUtil.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/JRTUtil.java
@@ -40,7 +40,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
@@ -77,6 +76,8 @@ public class JRTUtil {
*/
private static final Map ctSymFiles = new ConcurrentHashMap<>();
+ static final SoftClassCache classCache = new SoftClassCache();
+
public interface JrtFileVisitor {
public default FileVisitResult visitPackage(T dir, T mod, BasicFileAttributes attrs) throws IOException {
@@ -141,8 +142,8 @@ public static JrtFileSystem getJrtSystem(File image) {
* @param release --release version
*/
public static JrtFileSystem getJrtSystem(File image, String release) throws IOException {
- String key = image.toString();
Jdk jdk = new Jdk(image);
+ String key = jdk.path;
if (release != null && !jdk.sameRelease(release)) {
key = key + "|" + release; //$NON-NLS-1$
@@ -175,7 +176,6 @@ public static JrtFileSystem getJrtSystem(File image, String release) throws IOEx
* @param path
* absolute file path to a jar archive
* @return never null
- * @throws IOException
*/
public static FileSystem getJarFileSystem(Path path) throws IOException {
URI uri = URI.create("jar:file:" + path.toUri().getRawPath()); //$NON-NLS-1$
@@ -216,6 +216,7 @@ public static CtSym getCtSym(Path jdkHome) throws IOException {
/** TEST ONLY (use when changing the "modules.to.load" property). */
public static void reset() {
images.clear();
+ classCache.clear();
MODULE_TO_LOAD = System.getProperty("modules.to.load"); //$NON-NLS-1$
}
@@ -234,7 +235,6 @@ public static void reset() {
* @param image a java.io.File handle to the JRT image.
* @param visitor an instance of JrtFileVisitor to be notified of the entries in the JRT image.
* @param notify flag indicating the notifications the client is interested in.
- * @throws IOException
*/
public static void walkModuleImage(File image, final JRTUtil.JrtFileVisitor visitor, int notify) throws IOException {
JrtFileSystem system = getJrtSystem(image, null);
@@ -314,7 +314,6 @@ public static String sanitizedFileName(Path path) {
/**
* Tries to read all bytes of the file denoted by path,
* returns null if the file could not be found or if the read was interrupted.
- * @param path
* @return bytes or null
* @throws IOException any IO exception other than NoSuchFileException
*/
@@ -350,15 +349,14 @@ public static String getJdkRelease(File image) throws IOException {
class JrtFileSystemWithOlderRelease extends JrtFileSystem {
- private List releaseRoots;
- private CtSym ctSym;
+ private final List releaseRoots;
+ private final CtSym ctSym;
/**
* The jrt file system is based on the location of the JRE home whose libraries
* need to be loaded.
*
* @param release the older release where classes and modules should be searched for.
- * @throws IOException
*/
JrtFileSystemWithOlderRelease(Jdk jdkHome, String release) throws IOException {
super(jdkHome, release);
@@ -510,9 +508,6 @@ class JrtFileSystem {
private final Map> packageToModules = new HashMap>();
-
- private final Map> classCache = new ConcurrentHashMap<>(10007);
-
FileSystem fs;
Path modRoot;
Jdk jdk;
@@ -529,9 +524,6 @@ public static JrtFileSystem getNewJrtFileSystem(Jdk jdk, String release) throws
/**
* The jrt file system is based on the location of the JRE home whose libraries
* need to be loaded.
- *
- * @param jdkHome
- * @throws IOException
*/
JrtFileSystem(Jdk jdkHome, String release) throws IOException {
this.jdk = jdkHome;
@@ -663,18 +655,7 @@ private byte[] getFileBytes(String fileName, String module) throws IOException {
if(JRTUtil.DISABLE_CACHE) {
return JRTUtil.safeReadBytes(path);
} else {
- try {
- Optional bytes = this.classCache.computeIfAbsent(path, key -> {
- try {
- return Optional.ofNullable(JRTUtil.safeReadBytes(key));
- } catch (IOException e) {
- throw new RuntimeIOException(e);
- }
- });
- return bytes.orElse(null);
- } catch (RuntimeIOException rio) {
- throw rio.getCause();
- }
+ return JRTUtil.classCache.getClassBytes(this.jdk, path);
}
}
@@ -684,18 +665,7 @@ ClassFileReader getClassfileFromModule(String fileName, String module) throws IO
if(JRTUtil.DISABLE_CACHE) {
content = JRTUtil.safeReadBytes(path);
} else {
- try {
- Optional bytes = this.classCache.computeIfAbsent(path, key -> {
- try {
- return Optional.ofNullable(JRTUtil.safeReadBytes(key));
- } catch (IOException e) {
- throw new RuntimeIOException(e);
- }
- });
- content = bytes.orElse(null);
- } catch (RuntimeIOException rio) {
- throw rio.getCause();
- }
+ content = JRTUtil.classCache.getClassBytes(this.jdk, path);
}
if (content != null) {
ClassFileReader reader = new ClassFileReader(path.toUri(), content, fileName.toCharArray());
@@ -831,4 +801,4 @@ synchronized void cachePackage(String packageName, String module) {
public String getJdkRelease() {
return this.jdk.release;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Messages.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Messages.java
index d079a6cdca..525fb152c8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Messages.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Messages.java
@@ -125,6 +125,7 @@ private Messages() {
public static String pattern_matching_switch;
public static String record_patterns;
public static String unnammed_patterns_and_vars;
+ public static String unnamed_classes_and_instance_main_methods;
static {
initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/SoftClassCache.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/SoftClassCache.java
new file mode 100644
index 0000000000..e28375c4f3
--- /dev/null
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/SoftClassCache.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2023 Christoph Läubrich.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Christoph Läubrich - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.util;
+
+import java.io.IOException;
+import java.lang.ref.SoftReference;
+import java.nio.file.Path;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * Implements a soft cache for reading class files from disk, as these caches can grow quite large but data can be
+ * recovered afterwards we only hold a soft reference to the bytes itself.
+ */
+class SoftClassCache {
+
+ private final ConcurrentMap jdks = new ConcurrentHashMap<>();
+
+ void clear() {
+ this.jdks.clear();
+ }
+
+ public byte[] getClassBytes(Jdk jdk, Path path) throws IOException {
+ return this.jdks.computeIfAbsent(jdk.path, JdkClasses::new).get(path);
+ }
+
+ private static final class JdkClasses {
+ private final ConcurrentMap classes = new ConcurrentHashMap<>(10007);
+ private final String jdkPath;
+
+ public JdkClasses(String jdkPath) {
+ this.jdkPath = jdkPath;
+ }
+
+ public byte[] get(Path path) throws IOException {
+ return this.classes.computeIfAbsent(path, ClassBytes::new).getBytes();
+ }
+
+ @Override
+ public String toString() {
+ return "Class Cache for " + this.jdkPath; //$NON-NLS-1$
+ }
+ }
+
+ private static final class ClassBytes {
+ private final Path path;
+ private volatile boolean empty;
+ private volatile SoftReference bytes;
+
+ public ClassBytes(Path path) {
+ this.path = path;
+ }
+
+ public byte[] getBytes() throws IOException {
+ if (this.empty) {
+ return null;
+ }
+ SoftReference reference = this.bytes;
+ if (reference != null) {
+ byte[] bs = reference.get();
+ if (bs != null) {
+ return bs;
+ }
+ }
+ byte[] readBytes = JRTUtil.safeReadBytes(this.path);
+ if (readBytes == null) {
+ this.empty = true;
+ return null;
+ }
+ this.bytes = new SoftReference(readBytes);
+ return readBytes;
+ }
+ }
+
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java
index 27c21a5300..def3e77ac7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java
@@ -554,7 +554,6 @@ private static boolean startsWith(byte[] a, byte[] start) {
/**
* Returns a one line summary for an exception (extracted from its stacktrace: name + first frame)
- * @param exception
* @return one line summary for an exception
*/
public static String getExceptionSummary(Throwable exception) {
@@ -984,7 +983,6 @@ public static String toString(Object[] objects, Displayable renderer) {
* @param outputPath the given output directory
* @param relativeFileName the given relative file name
* @param classFile the given classFile to write
- *
*/
public static void writeToDisk(boolean generatePackagesStructure, String outputPath, String relativeFileName, ClassFile classFile) throws IOException {
FileOutputStream file = getFileOutputStream(generatePackagesStructure, outputPath, relativeFileName);
@@ -1666,4 +1664,4 @@ public static void appendEscapedChar(StringBuffer buffer, char c, boolean string
private static IllegalArgumentException newIllegalArgumentException(char[] string, int start) {
return new IllegalArgumentException("\"" + String.valueOf(string) + "\" at " + start); //$NON-NLS-1$ //$NON-NLS-2$
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java
index 1a7db581b9..4bfe2837cf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java
@@ -22,9 +22,9 @@
public class EfficiencyCompilerRequestor implements IDebugRequestor {
private boolean isActive = false;
- private ArrayList compiledClasses = new ArrayList<>();
- private ArrayList compiledFiles = new ArrayList<>();
- private ArrayList classes = new ArrayList<>();
+ private final ArrayList compiledClasses = new ArrayList<>();
+ private final ArrayList compiledFiles = new ArrayList<>();
+ private final ArrayList classes = new ArrayList<>();
public void acceptDebugResult(CompilationResult result){
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java
index 67f061434c..efbcdeab01 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java
@@ -31,6 +31,9 @@
@SuppressWarnings({"rawtypes", "unchecked"})
public class IncrementalTests extends BuilderTests {
+ static {
+// TESTS_NAMES = new String [] { "testBinaryInnerRecordClass" };
+ }
public IncrementalTests(String name) {
super(name);
}
@@ -606,22 +609,22 @@ public void testMemberTypeFromClassFile() throws JavaModelException {
public void testMemberTypeOfOtherProject() throws JavaModelException {
IPath projectPath1 = env.addProject("Project1", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$
env.addExternalJars(projectPath1, Util.getJavaClassLibs());
-
+
IPath projectPath2 = env.addProject("Project2", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$
env.addExternalJars(projectPath2, Util.getJavaClassLibs());
-
+
// remove old package fragment root so that names don't collide
env.removePackageFragmentRoot(projectPath1, ""); //$NON-NLS-1$
IPath root1 = env.addPackageFragmentRoot(projectPath1, "src"); //$NON-NLS-1$
env.setOutputFolder(projectPath1, "bin"); //$NON-NLS-1$
-
+
// remove old package fragment root so that names don't collide
env.removePackageFragmentRoot(projectPath2, ""); //$NON-NLS-1$
IPath root2 = env.addPackageFragmentRoot(projectPath2, "src"); //$NON-NLS-1$
IPath output2 = env.setOutputFolder(projectPath2, "bin"); //$NON-NLS-1$
-
+
env.addClassFolder(projectPath1, output2, true);
env.addRequiredProject(projectPath2, projectPath1);
@@ -633,14 +636,14 @@ public void testMemberTypeOfOtherProject() throws JavaModelException {
" }\n" + //$NON-NLS-1$
" }\n" + //$NON-NLS-1$
"}\n");//$NON-NLS-1$
-
+
env.addClass(root1, "pR", "ReferencingClass", //$NON-NLS-1$ //$NON-NLS-2$
"package pR; \n"+ //$NON-NLS-1$
"import pD.DerivedClass.Builder;\n"+ //$NON-NLS-1$
"public class ReferencingClass {\n" + //$NON-NLS-1$
" Builder builder = new Builder(null);\n" + //$NON-NLS-1$
"}\n"); //$NON-NLS-1$
-
+
env.addClass(root2, "pD", "DerivedClass", //$NON-NLS-1$ //$NON-NLS-2$
"package pD; \n"+ //$NON-NLS-1$
"public class DerivedClass extends pB.BaseClass {\n" + //$NON-NLS-1$
@@ -667,22 +670,22 @@ public void testMemberTypeOfOtherProject() throws JavaModelException {
public void test$InTypeName() throws JavaModelException {
IPath projectPath1 = env.addProject("Project1", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$
env.addExternalJars(projectPath1, Util.getJavaClassLibs());
-
+
IPath projectPath2 = env.addProject("Project2", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$
env.addExternalJars(projectPath2, Util.getJavaClassLibs());
-
+
// remove old package fragment root so that names don't collide
env.removePackageFragmentRoot(projectPath1, ""); //$NON-NLS-1$
IPath root1 = env.addPackageFragmentRoot(projectPath1, "src"); //$NON-NLS-1$
env.setOutputFolder(projectPath1, "bin"); //$NON-NLS-1$
-
+
// remove old package fragment root so that names don't collide
env.removePackageFragmentRoot(projectPath2, ""); //$NON-NLS-1$
IPath root2 = env.addPackageFragmentRoot(projectPath2, "src"); //$NON-NLS-1$
IPath output2 = env.setOutputFolder(projectPath2, "bin"); //$NON-NLS-1$
-
+
env.addClassFolder(projectPath1, output2, true);
env.addRequiredProject(projectPath2, projectPath1);
@@ -692,14 +695,14 @@ public void testMemberTypeOfOtherProject() throws JavaModelException {
" public Builder$a(T t) {\n" + //$NON-NLS-1$
" }\n" + //$NON-NLS-1$
"}\n");//$NON-NLS-1$
-
+
env.addClass(root1, "pR", "ReferencingClass", //$NON-NLS-1$ //$NON-NLS-2$
"package pR; \n"+ //$NON-NLS-1$
"import pD.DerivedClass$a;\n"+ //$NON-NLS-1$
"public class ReferencingClass {\n" + //$NON-NLS-1$
" DerivedClass$a builder = new DerivedClass$a(null);\n" + //$NON-NLS-1$
"}\n"); //$NON-NLS-1$
-
+
env.addClass(root2, "pD", "DerivedClass$a", //$NON-NLS-1$ //$NON-NLS-2$
"package pD; \n"+ //$NON-NLS-1$
"public class DerivedClass$a extends pB.Builder$a {\n" + //$NON-NLS-1$
@@ -1149,13 +1152,13 @@ public void testBug334377() throws JavaModelException {
IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$
env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$
- env.addClass(root, "", "Upper",
+ env.addClass(root, "", "Upper",
"public abstract class Upper {\n" +
" public static enum Mode {IN,OUT;}\n" +
"}\n");
- env.addClass(root, "", "Lower",
+ env.addClass(root, "", "Lower",
"public class Lower extends Upper {};\n");
- env.addClass(root, "", "Bug",
+ env.addClass(root, "", "Bug",
"public class Bug {\n" +
" Upper.Mode m1;\n" +
" void usage(){\n" +
@@ -1173,7 +1176,7 @@ public void testBug334377() throws JavaModelException {
fullBuild(projectPath);
expectingNoProblems();
- env.addClass(root, "", "Bug",
+ env.addClass(root, "", "Bug",
"public class Bug {\n" +
" Upper.Mode m1;\n" +
" void usage(){\n" +
@@ -1197,7 +1200,7 @@ public void testBug334377() throws JavaModelException {
JavaCore.setOptions(options);
}
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=364450
// Incremental build should not generate buildpath error
// NOT generated by full build.
@@ -1237,28 +1240,28 @@ public void testBug364450() throws JavaModelException {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=520640
public void testRemovePackageInDependencyProject() throws JavaModelException {
- IPath projectPath1 = env.addProject("Project1");
+ IPath projectPath1 = env.addProject("Project1");
env.addExternalJars(projectPath1, Util.getJavaClassLibs());
-
- IPath projectPath2 = env.addProject("Project2");
+
+ IPath projectPath2 = env.addProject("Project2");
env.addExternalJars(projectPath2, Util.getJavaClassLibs());
-
-
+
+
env.addRequiredProject(projectPath1, projectPath2);
-
- env.addPackage(projectPath2, "emptypackage");
+
+ env.addPackage(projectPath2, "emptypackage");
fullBuild();
expectingNoProblems();
-
- env.removePackage(projectPath2, "emptypackage");
+
+ env.removePackage(projectPath2, "emptypackage");
incrementalBuild();
expectingNoProblems();
-
+
env.removeProject(projectPath2);
env.removeProject(projectPath1);
}
-
+
public void testBug526376() throws JavaModelException {
IPath projectPath = env.addProject("Project");
env.addExternalJars(projectPath, Util.getJavaClassLibs());
@@ -1285,4 +1288,111 @@ public void testBug526376() throws JavaModelException {
env.removeProject(projectPath);
}
+ // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1497
+ public void testBinaryRecordClass() throws JavaModelException {
+ IPath projectPath = env.addProject("Project", "16");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "", "R",
+ "public record R(int x, int y) {}\n");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ IPath aPath = env.addClass(root, "", "X",
+ "public class X extends R {}\n");
+
+ incrementalBuild(projectPath);
+ expectingSpecificProblemFor(aPath, new Problem("X", "The record R cannot be the superclass of X; a record is final and cannot be extended", aPath, 23, 24, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ env.removeProject(projectPath);
+ }
+ // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1497
+ public void testBinaryRecordClassWithGenericSuper() throws JavaModelException {
+ IPath projectPath = env.addProject("Project", "16");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "", "R",
+ "interface I {}\n" +
+ "public record R(int x, int y) implements I {}\n");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ IPath aPath = env.addClass(root, "", "X",
+ "public class X extends R {}\n");
+
+ incrementalBuild(projectPath);
+ expectingSpecificProblemFor(aPath, new Problem("X", "The record R cannot be the superclass of X; a record is final and cannot be extended", aPath, 23, 24, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ env.removeProject(projectPath);
+ }
+
+ // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1497
+ public void testBinaryInnerRecordClass() throws JavaModelException {
+ IPath projectPath = env.addProject("Project", "16");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "", "O",
+ "public class O {\n" +
+ " public static record R(int x, int y) {}\n" +
+ "}\n");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ IPath aPath = env.addClass(root, "", "X",
+ "public class X extends O.R {}\n");
+
+ incrementalBuild(projectPath);
+ expectingSpecificProblemFor(aPath, new Problem("X", "The record O.R cannot be the superclass of X; a record is final and cannot be extended", aPath, 23, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ env.removeProject(projectPath);
+ }
+ // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1497
+ public void testBinaryInnerRecordClassWithGenericSuper() throws JavaModelException {
+ IPath projectPath = env.addProject("Project", "16");
+ env.addExternalJars(projectPath, Util.getJavaClassLibs());
+
+ // remove old package fragment root so that names don't collide
+ env.removePackageFragmentRoot(projectPath, "");
+
+ IPath root = env.addPackageFragmentRoot(projectPath, "src");
+ env.setOutputFolder(projectPath, "bin");
+
+ env.addClass(root, "", "O",
+ "public class O {\n" +
+ " interface I {}\n" +
+ " public static record R(int x, int y) implements I {}\n" +
+ "}\n");
+
+ fullBuild(projectPath);
+ expectingNoProblems();
+
+ IPath aPath = env.addClass(root, "", "X",
+ "public class X extends O.R {}\n");
+
+ incrementalBuild(projectPath);
+ expectingSpecificProblemFor(aPath, new Problem("X", "The record O.R cannot be the superclass of X; a record is final and cannot be extended", aPath, 23, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$
+
+ env.removeProject(projectPath);
+ }
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java
index b4325803a1..1077a7773f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java
@@ -380,7 +380,6 @@ public void processAnnotations(BuildContext[] files) {
/**
* Test that a build participant can inspect the declared annotations by name
- * @throws JavaModelException
*/
public void testProcessAnnotationHasAnnotation() throws JavaModelException {
IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java
index f2f334876c..7fd81b99f5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java
@@ -19,9 +19,9 @@
@SuppressWarnings("rawtypes")
public class Problem implements Comparable {
- private String location;
- private String message;
- private IPath resourcePath;
+ private final String location;
+ private final String message;
+ private final IPath resourcePath;
private int start = -1, end = -1, categoryId = -1;
private String sourceId;
private int severity = IMarker.SEVERITY_ERROR;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
index 80b0b71fed..c0648592ae 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -23,6 +23,7 @@ Require-Bundle: org.junit;bundle-version="3.8.1",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional,
org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional
+Import-Package: jakarta.annotation;version="[2.1.0,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Eclipse-BundleShape: dir
Bundle-Activator: org.eclipse.jdt.core.tests.compiler.Activator
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
index aec47f4dbe..3936585a6b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java
@@ -62,8 +62,8 @@ public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDoc
CHECK_DOCUMENT_ELEMENT_PARSER | CHECK_COMMENT_RECORDER_PARSER |
CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER);
public static boolean optimizeStringLiterals = false;
- private String referenceCompiler;
- private String referenceCompilerTestsScratchArea;
+ private final String referenceCompiler;
+ private final String referenceCompilerTestsScratchArea;
public AbstractSyntaxTreeTest(String name, String referenceCompiler, String referenceCompilerTestsScratchArea) {
super(name);
@@ -482,4 +482,4 @@ public void exitType(int declarationEnd) {
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java
index c2a2e01089..95a31bba31 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java
@@ -1308,7 +1308,6 @@ public void test35() {
}
/*
* Invalid completion inside a comment
- *
*/
public void test36() {
@@ -1342,7 +1341,6 @@ public void test36() {
}
/*
* Invalid completion inside a string literal
- *
*/
public void test37() {
@@ -1378,7 +1376,6 @@ public void test37() {
}
/*
* Invalid completion inside a number literal
- *
*/
public void test38() {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
index 627a9a2484..ee0297ad63 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java
@@ -5197,7 +5197,6 @@ public void test76() {
/**
* Bug 99662:[1.5] JavaModel returns inexistent IType for package-info ICompilationUnits
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=99662"
- *
*/
public void testBug99662() {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java
index 7e2bf6ae11..b2de2d5f53 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java
@@ -17,17 +17,17 @@
import org.eclipse.jdt.internal.compiler.env.ISourceMethod;
public class SourceMethod implements ISourceMethod {
- private int modifiers;
- private int declarationStart;
+ private final int modifiers;
+ private final int declarationStart;
private int declarationEnd;
- private char[] returnTypeName;
- private char[] selector;
- private int nameSourceStart;
- private int nameSourceEnd;
- private char[][] argumentTypeNames;
- private char[][] argumentNames;
- private char[][] exceptionTypeNames;
- private char[] source;
+ private final char[] returnTypeName;
+ private final char[] selector;
+ private final int nameSourceStart;
+ private final int nameSourceEnd;
+ private final char[][] argumentTypeNames;
+ private final char[][] argumentNames;
+ private final char[][] exceptionTypeNames;
+ private final char[] source;
private String explicitConstructorCall;
char[][] typeParameterNames;
char[][][] typeParameterBounds;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java
index ac6ad0df47..3123737ad2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java
@@ -16,16 +16,16 @@
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
public final class SourceType {
- private int modifiers;
- private int declarationStart;
+ private final int modifiers;
+ private final int declarationStart;
private int declarationEnd;
private char[] fileName;
private SourcePackage packageName;
private SourceImport[] imports;
- private char[] enclosingTypeName;
- private char[] name;
- private int nameSourceStart;
- private int nameSourceEnd;
+ private final char[] enclosingTypeName;
+ private final char[] name;
+ private final int nameSourceStart;
+ private final int nameSourceEnd;
private char[] superclassName;
private char[][] interfaceNames;
private SourceType[] memberTypes;
@@ -36,7 +36,7 @@ public final class SourceType {
private SourceField[] recordComponents;
private int numberOfFields;
private int numberOfComponents;
- private char[] source;
+ private final char[] source;
SourceType parent;
char[][] typeParameterNames;
char[][][] typeParameterBounds;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
index f65865550b..b64cfb025e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
@@ -254,6 +254,18 @@ public static TestSuite getTestSuite(boolean addComplianceDiagnoseTest) {
TestCase.RUN_ONLY_ID = null;
all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_19), tests_19));
}
+ if ((possibleComplianceLevels & AbstractCompilerTest.F_21) != 0) {
+ ArrayList tests_21 = (ArrayList)testClasses.clone();
+ tests_21.addAll(TEST_CLASSES_1_5);
+ addJava16Tests(tests_21);
+ // Reset forgotten subsets tests
+ TestCase.TESTS_PREFIX = null;
+ TestCase.TESTS_NAMES = null;
+ TestCase.TESTS_NUMBERS= null;
+ TestCase.TESTS_RANGE = null;
+ TestCase.RUN_ONLY_ID = null;
+ all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_21), tests_21));
+ }
return all;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java
index 475714913d..ea599e6ca6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java
@@ -52,7 +52,7 @@ public static boolean isJREVersionEqualTo(String compilerVersion) {
* here, that is {@link #normalized(String) normalized}.
*/
protected static abstract class Normalizer {
- private Normalizer nextInChain;
+ private final Normalizer nextInChain;
Normalizer(Normalizer nextInChain) {
this.nextInChain = nextInChain;
}
@@ -71,9 +71,9 @@ String normalized(String originalValue) {
* placeholder.
*/
protected static class StringNormalizer extends Normalizer {
- private String match;
- private int matchLength;
- private String placeholder;
+ private final String match;
+ private final int matchLength;
+ private final String placeholder;
StringNormalizer(Normalizer nextInChain, String match, String placeholder) {
super(nextInChain);
this.match = match;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java
index d24aa18753..48504c3e61 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java
@@ -44,7 +44,7 @@ public class AbstractComparableTest extends AbstractRegressionTest {
protected static final String JAVAX_INJECT_NAME = "javax/inject/Inject.java";
protected static final String JAVAX_INJECT_CONTENT =
- "package javax.inject;\n" +
+ "package jakarta.inject;\n" +
"import static java.lang.annotation.ElementType.*;\n" +
"import java.lang.annotation.Retention;\n" +
"import static java.lang.annotation.RetentionPolicy.RUNTIME;\n" +
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
index 3050be97a2..298d77d74a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -595,8 +595,8 @@ long compile(File directory, String options, String[] sourceFileNames, StringBuf
}
}
static class JavaRuntime {
- private String rootDirectoryPath;
- private String javaPathName;
+ private final String rootDirectoryPath;
+ private final String javaPathName;
String version; // not intended to be modified - one of JavaCore.VERSION_1_*
String rawVersion; // not intended to be modified - more complete version name
int minor;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
index a81267098b..97002614d6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
@@ -10732,7 +10732,7 @@ public void testBug376590a() {
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
}
// https://bugs.eclipse.org/376590 - Private fields with @Inject are ignored by unused field validation
-// using javax.inject.Inject - slight variation
+// using jakarta.inject.Inject - slight variation
public void testBug376590b() {
Map customOptions = getCompilerOptions();
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
@@ -10744,17 +10744,17 @@ public void testBug376590b() {
JAVAX_INJECT_CONTENT,
"Example.java",
"class Example {\n" +
- " private @javax.inject.Inject Object o;\n" +
+ " private @jakarta.inject.Inject Object o;\n" +
" private Example() {} // also warn here: no @Inject\n" +
" public Example(Object o) { this.o = o; }\n" +
- " private @javax.inject.Inject void setO(Object o) { this.o = o;}\n" +
+ " private @jakarta.inject.Inject void setO(Object o) { this.o = o;}\n" +
"}\n"
},
null, customOptions,
"----------\n" +
"1. ERROR in Example.java (at line 2)\n" +
- " private @javax.inject.Inject Object o;\n" +
- " ^\n" +
+ " private @jakarta.inject.Inject Object o;\n" +
+ " ^\n" +
"The value of the field Example.o is not used\n" +
"----------\n" +
"2. ERROR in Example.java (at line 3)\n" +
@@ -10765,7 +10765,7 @@ public void testBug376590b() {
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
}
// https://bugs.eclipse.org/376590 - Private fields with @Inject are ignored by unused field validation
-// using javax.inject.Inject, combined with standard as well as custom annotations
+// using jakarta.inject.Inject, combined with standard as well as custom annotations
public void testBug376590c() {
Map customOptions = getCompilerOptions();
customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
@@ -10778,7 +10778,7 @@ public void testBug376590c() {
JAVAX_INJECT_NAME,
JAVAX_INJECT_CONTENT,
"Example.java",
- "import javax.inject.Inject;\n" +
+ "import jakarta.inject.Inject;\n" +
"class Example {\n" +
" private @Inject @p.NonNull Object o; // do warn, annotations don't signal a read\n" +
" private @Deprecated @Inject String old; // do warn, annotations don't signal a read\n" +
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
index 11c211a41e..07cc7187af 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
@@ -89,8 +89,8 @@ public static Class testClass() {
return BatchCompilerTest.class;
}
static class StringMatcher extends Matcher {
- private String expected;
- private Normalizer normalizer;
+ private final String expected;
+ private final Normalizer normalizer;
StringMatcher(String expected, Normalizer normalizer) {
this.expected = expected;
this.normalizer = normalizer;
@@ -111,7 +111,7 @@ String expected() {
}
}
static class SubstringMatcher extends Matcher {
- private String substring;
+ private final String substring;
SubstringMatcher(String substring) {
this.substring = substring;
}
@@ -169,7 +169,8 @@ String normalized(String originalValue) {
* This normalizer removes a selected range of lines from a log file.
*/
private static class LinesRangeNormalizer extends Normalizer {
- private int first, number;
+ private final int first;
+ private int number;
LinesRangeNormalizer() {
super(null);
@@ -13520,4 +13521,4 @@ public void testGitHub1122(){
+ "",
true);
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
index fcd4671cf3..931c1f2497 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
@@ -1324,6 +1324,7 @@ class ProblemAttributes {
expectedProblemAttributes.put("RawTypeInRecordPattern", new ProblemAttributes(true));
expectedProblemAttributes.put("FalseConstantInGuard", new ProblemAttributes(true));
expectedProblemAttributes.put("CannotInferRecordPatternTypes", new ProblemAttributes(true));
+ expectedProblemAttributes.put("IllegalRecordPattern", new ProblemAttributes(true));
expectedProblemAttributes.put("ClassExtendFinalRecord", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("RecordErasureIncompatibilityInCanonicalConstructor", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("JavadocInvalidModule", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
@@ -2424,6 +2425,7 @@ class ProblemAttributes {
expectedProblemAttributes.put("RawTypeInRecordPattern", SKIP);
expectedProblemAttributes.put("FalseConstantInGuard", SKIP);
expectedProblemAttributes.put("CannotInferRecordPatternTypes", SKIP);
+ expectedProblemAttributes.put("IllegalRecordPattern", SKIP);
expectedProblemAttributes.put("ClassExtendFinalRecord", SKIP);
expectedProblemAttributes.put("RecordErasureIncompatibilityInCanonicalConstructor", SKIP);
expectedProblemAttributes.put("JavadocInvalidModule", SKIP);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated18Test.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated18Test.java
index 7068824a67..33c0705072 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated18Test.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated18Test.java
@@ -37,7 +37,7 @@ public void test412555() {
"X.java",
"public class X {\n" +
" public static void main(String[] args) {\n" +
- " Runnable r = () -> {\n" +
+ " Runnable r = () -> {\n" +
" Y.callMe();\n" +
" };\n" +
" }\n" +
@@ -48,16 +48,72 @@ public void test412555() {
" public static void callMe() {}\n" +
"}\n",
},
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " Y.callMe();\n" +
- " ^^^^^^^^\n" +
- "The method callMe() from the type Y is deprecated\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " Y.callMe();\n" +
+ " ^^^^^^^^\n" +
+ "The method callMe() from the type Y is deprecated\n" +
"----------\n",
null,
true,
options);
}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1370
+// Deprecation warnings are not suppressed in lambdas of deprecated methods
+public void testGH1370() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ false /* skipJavac */,
+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError,
+ new String[] {
+ "X.java",
+ """
+ public class X {
+ @Deprecated
+ static void deprecatedMethod(Object o) {}
+ }
+ """,
+ "Y.java",
+ """
+ import java.util.List;
+ public class Y {
+ @Deprecated
+ void callDeprecated() {
+ X.deprecatedMethod(null); // no warning
+ List.of().forEach(X::deprecatedMethod); // no warning
+ List.of().forEach(o -> X.deprecatedMethod(o)); // warning
+ }
+ void callDeprecated2() {
+ X.deprecatedMethod(null);
+ List.of().forEach(X::deprecatedMethod);
+ List.of().forEach(o -> X.deprecatedMethod(o));
+ }
+ }
+ """,
+ },
+ """
+ ----------
+ 1. ERROR in Y.java (at line 10)
+ X.deprecatedMethod(null);
+ ^^^^^^^^^^^^^^^^^^^^^^
+ The method deprecatedMethod(Object) from the type X is deprecated
+ ----------
+ 2. ERROR in Y.java (at line 11)
+ List.of().forEach(X::deprecatedMethod);
+ ^^^^^^^^^^^^^^^^^^^
+ The method deprecatedMethod(Object) from the type X is deprecated
+ ----------
+ 3. ERROR in Y.java (at line 12)
+ List.of().forEach(o -> X.deprecatedMethod(o));
+ ^^^^^^^^^^^^^^^^^^^
+ The method deprecatedMethod(Object) from the type X is deprecated
+ ----------
+ """,
+ null,
+ true,
+ options);
+}
public static Class testClass() {
return Deprecated18Test.class;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java
index 460219383c..5caa9f7d67 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java
@@ -221,20 +221,20 @@ public void test005a() {
},
null, customOptions,
"----------\n" +
- "1. ERROR in p2\\C.java (at line 3)\n" +
- " void bar(p1.X.Inner a) {\n" +
- " ^\n" +
- "The type X has been deprecated and marked for removal\n" +
- "----------\n" +
- "2. ERROR in p2\\C.java (at line 3)\n" +
- " void bar(p1.X.Inner a) {\n" +
- " ^^^^^\n" +
- "The type X.Inner has been deprecated and marked for removal\n" +
- "----------\n" +
- "3. ERROR in p2\\C.java (at line 4)\n" +
- " a.foo();\n" +
- " ^^^^^\n" +
- "The method foo() from the type X.Inner has been deprecated and marked for removal\n" +
+ "1. ERROR in p2\\C.java (at line 3)\n" +
+ " void bar(p1.X.Inner a) {\n" +
+ " ^\n" +
+ "The type X has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "2. ERROR in p2\\C.java (at line 3)\n" +
+ " void bar(p1.X.Inner a) {\n" +
+ " ^^^^^\n" +
+ "The type X.Inner has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "3. ERROR in p2\\C.java (at line 4)\n" +
+ " a.foo();\n" +
+ " ^^^^^\n" +
+ "The method foo() from the type X.Inner has been deprecated and marked for removal\n" +
"----------\n",
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
}
@@ -275,7 +275,7 @@ public void test005c() {
"package p1;\n" +
"public class X {\n" +
" public static class Inner {\n" +
- " @java.lang.Deprecated(forRemoval=true)\n" +
+ " @java.lang.Deprecated(forRemoval=true)\n" +
" public void foo() {}\n" +
" }\n" +
"}\n",
@@ -293,10 +293,10 @@ public void test005c() {
};
runner.expectedCompilerLog =
"----------\n" +
- "1. WARNING in p2\\C.java (at line 5)\n" +
- " a.foo();\n" +
- " ^^^^^\n" +
- "The method foo() from the type X.Inner has been deprecated and marked for removal\n" +
+ "1. WARNING in p2\\C.java (at line 5)\n" +
+ " a.foo();\n" +
+ " ^^^^^\n" +
+ "The method foo() from the type X.Inner has been deprecated and marked for removal\n" +
"----------\n";
runner.runWarningTest();
}
@@ -322,11 +322,11 @@ public void test006() {
"}"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. WARNING in test1\\E02.java (at line 3)\n" +
- " public void foo(E01 arg) {\n" +
- " ^^^\n" +
- "The type E01 is deprecated since version 4\n" +
+ "----------\n" +
+ "1. WARNING in test1\\E02.java (at line 3)\n" +
+ " public void foo(E01 arg) {\n" +
+ " ^^^\n" +
+ "The type E01 is deprecated since version 4\n" +
"----------\n";
runner.runWarningTest();
}
@@ -356,16 +356,16 @@ public void test007() {
"}\n",
},
null, customOptions,
- "----------\n" +
- "1. WARNING in p2\\C.java (at line 4)\n" +
- " @Override public void foo() {}\n" +
- " ^^^^^\n" +
- "The method C.foo() overrides a deprecated method from X\n" +
- "----------\n" +
- "2. ERROR in p2\\C.java (at line 5)\n" +
- " @Override public void bar() {}\n" +
- " ^^^^^\n" +
- "The method C.bar() overrides a method from X that has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "1. WARNING in p2\\C.java (at line 4)\n" +
+ " @Override public void foo() {}\n" +
+ " ^^^^^\n" +
+ "The method C.foo() overrides a deprecated method from X\n" +
+ "----------\n" +
+ "2. ERROR in p2\\C.java (at line 5)\n" +
+ " @Override public void bar() {}\n" +
+ " ^^^^^\n" +
+ "The method C.bar() overrides a method from X that has been deprecated and marked for removal\n" +
"----------\n",
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
}
@@ -401,46 +401,46 @@ public void testSinceSource() {
"}"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. WARNING in test1\\E02.java (at line 4)\n" +
- " System.out.println(new E01.Old());\n" +
- " ^^^^^^^^^\n" +
- "The constructor E01.Old() is deprecated since version 1.0\n" +
- "----------\n" +
- "2. WARNING in test1\\E02.java (at line 4)\n" +
- " System.out.println(new E01.Old());\n" +
- " ^^^\n" +
- "The type E01.Old is deprecated since version 1.0\n" +
- "----------\n" +
- "3. WARNING in test1\\E02.java (at line 5)\n" +
- " E01 e = new E01();\n" +
- " ^^^^^\n" +
- "The constructor E01() is deprecated since version 3.0.0\n" +
- "----------\n" +
- "4. WARNING in test1\\E02.java (at line 6)\n" +
- " e.old();\n" +
- " ^^^^^\n" +
- "The method old() from the type E01 is deprecated since version 4-SNAPSHOT\n" +
- "----------\n" +
- "5. WARNING in test1\\E02.java (at line 7)\n" +
- " System.out.println(E01.x);\n" +
- " ^\n" +
- "The field E01.x is deprecated since version 2\n" +
- "----------\n" +
- "6. WARNING in test1\\E02.java (at line 8)\n" +
- " System.out.println(E01.y);\n" +
- " ^\n" +
- "The field E01.y is deprecated since version 2\n" +
- "----------\n" +
- "7. WARNING in test1\\E02.java (at line 10)\n" +
- " class E03 extends E01 {\n" +
- " ^^^\n" +
- "The constructor E01() is deprecated since version 3.0.0\n" +
- "----------\n" +
- "8. WARNING in test1\\E02.java (at line 11)\n" +
- " protected void old() {}\n" +
- " ^^^^^\n" +
- "The method E02.E03.old() overrides a method from E01 that is deprecated since version 4-SNAPSHOT\n" +
+ "----------\n" +
+ "1. WARNING in test1\\E02.java (at line 4)\n" +
+ " System.out.println(new E01.Old());\n" +
+ " ^^^^^^^^^\n" +
+ "The constructor E01.Old() is deprecated since version 1.0\n" +
+ "----------\n" +
+ "2. WARNING in test1\\E02.java (at line 4)\n" +
+ " System.out.println(new E01.Old());\n" +
+ " ^^^\n" +
+ "The type E01.Old is deprecated since version 1.0\n" +
+ "----------\n" +
+ "3. WARNING in test1\\E02.java (at line 5)\n" +
+ " E01 e = new E01();\n" +
+ " ^^^^^\n" +
+ "The constructor E01() is deprecated since version 3.0.0\n" +
+ "----------\n" +
+ "4. WARNING in test1\\E02.java (at line 6)\n" +
+ " e.old();\n" +
+ " ^^^^^\n" +
+ "The method old() from the type E01 is deprecated since version 4-SNAPSHOT\n" +
+ "----------\n" +
+ "5. WARNING in test1\\E02.java (at line 7)\n" +
+ " System.out.println(E01.x);\n" +
+ " ^\n" +
+ "The field E01.x is deprecated since version 2\n" +
+ "----------\n" +
+ "6. WARNING in test1\\E02.java (at line 8)\n" +
+ " System.out.println(E01.y);\n" +
+ " ^\n" +
+ "The field E01.y is deprecated since version 2\n" +
+ "----------\n" +
+ "7. WARNING in test1\\E02.java (at line 10)\n" +
+ " class E03 extends E01 {\n" +
+ " ^^^\n" +
+ "The constructor E01() is deprecated since version 3.0.0\n" +
+ "----------\n" +
+ "8. WARNING in test1\\E02.java (at line 11)\n" +
+ " protected void old() {}\n" +
+ " ^^^^^\n" +
+ "The method E02.E03.old() overrides a method from E01 that is deprecated since version 4-SNAPSHOT\n" +
"----------\n";
runner.runWarningTest();
}
@@ -482,46 +482,46 @@ public void testSinceBinary() {
"}"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. WARNING in test1\\E02.java (at line 4)\n" +
- " System.out.println(new E01.Old());\n" +
- " ^^^^^^^^^\n" +
- "The constructor E01.Old() is deprecated since version 1.0\n" +
- "----------\n" +
- "2. WARNING in test1\\E02.java (at line 4)\n" +
- " System.out.println(new E01.Old());\n" +
- " ^^^\n" +
- "The type E01.Old is deprecated since version 1.0\n" +
- "----------\n" +
- "3. WARNING in test1\\E02.java (at line 5)\n" +
- " E01 e = new E01();\n" +
- " ^^^^^\n" +
- "The constructor E01() is deprecated since version 3.0.0\n" +
- "----------\n" +
- "4. WARNING in test1\\E02.java (at line 6)\n" +
- " e.old();\n" +
- " ^^^^^\n" +
- "The method old() from the type E01 is deprecated since version 4-SNAPSHOT\n" +
- "----------\n" +
- "5. WARNING in test1\\E02.java (at line 7)\n" +
- " System.out.println(E01.x);\n" +
- " ^\n" +
- "The field E01.x is deprecated since version 2\n" +
- "----------\n" +
- "6. WARNING in test1\\E02.java (at line 8)\n" +
- " System.out.println(E01.y);\n" +
- " ^\n" +
- "The field E01.y is deprecated since version 2\n" +
- "----------\n" +
- "7. WARNING in test1\\E02.java (at line 10)\n" +
- " class E03 extends E01 {\n" +
- " ^^^\n" +
- "The constructor E01() is deprecated since version 3.0.0\n" +
- "----------\n" +
- "8. WARNING in test1\\E02.java (at line 11)\n" +
- " protected void old() {}\n" +
- " ^^^^^\n" +
- "The method E02.E03.old() overrides a method from E01 that is deprecated since version 4-SNAPSHOT\n" +
+ "----------\n" +
+ "1. WARNING in test1\\E02.java (at line 4)\n" +
+ " System.out.println(new E01.Old());\n" +
+ " ^^^^^^^^^\n" +
+ "The constructor E01.Old() is deprecated since version 1.0\n" +
+ "----------\n" +
+ "2. WARNING in test1\\E02.java (at line 4)\n" +
+ " System.out.println(new E01.Old());\n" +
+ " ^^^\n" +
+ "The type E01.Old is deprecated since version 1.0\n" +
+ "----------\n" +
+ "3. WARNING in test1\\E02.java (at line 5)\n" +
+ " E01 e = new E01();\n" +
+ " ^^^^^\n" +
+ "The constructor E01() is deprecated since version 3.0.0\n" +
+ "----------\n" +
+ "4. WARNING in test1\\E02.java (at line 6)\n" +
+ " e.old();\n" +
+ " ^^^^^\n" +
+ "The method old() from the type E01 is deprecated since version 4-SNAPSHOT\n" +
+ "----------\n" +
+ "5. WARNING in test1\\E02.java (at line 7)\n" +
+ " System.out.println(E01.x);\n" +
+ " ^\n" +
+ "The field E01.x is deprecated since version 2\n" +
+ "----------\n" +
+ "6. WARNING in test1\\E02.java (at line 8)\n" +
+ " System.out.println(E01.y);\n" +
+ " ^\n" +
+ "The field E01.y is deprecated since version 2\n" +
+ "----------\n" +
+ "7. WARNING in test1\\E02.java (at line 10)\n" +
+ " class E03 extends E01 {\n" +
+ " ^^^\n" +
+ "The constructor E01() is deprecated since version 3.0.0\n" +
+ "----------\n" +
+ "8. WARNING in test1\\E02.java (at line 11)\n" +
+ " protected void old() {}\n" +
+ " ^^^^^\n" +
+ "The method E02.E03.old() overrides a method from E01 that is deprecated since version 4-SNAPSHOT\n" +
"----------\n";
runner.runWarningTest();
}
@@ -557,46 +557,46 @@ public void testSinceTerminally() {
"}"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. ERROR in test1\\E02.java (at line 4)\n" +
- " System.out.println(new E01.Old());\n" +
- " ^^^^^^^^^\n" +
- "The constructor E01.Old() has been deprecated since version 1.0 and marked for removal\n" +
- "----------\n" +
- "2. ERROR in test1\\E02.java (at line 4)\n" +
- " System.out.println(new E01.Old());\n" +
- " ^^^\n" +
- "The type E01.Old has been deprecated since version 1.0 and marked for removal\n" +
- "----------\n" +
- "3. ERROR in test1\\E02.java (at line 5)\n" +
- " E01 e = new E01();\n" +
- " ^^^^^\n" +
- "The constructor E01() has been deprecated since version 3.0.0 and marked for removal\n" +
- "----------\n" +
- "4. ERROR in test1\\E02.java (at line 6)\n" +
- " e.old();\n" +
- " ^^^^^\n" +
- "The method old() from the type E01 has been deprecated since version 4-SNAPSHOT and marked for removal\n" +
- "----------\n" +
- "5. ERROR in test1\\E02.java (at line 7)\n" +
- " System.out.println(E01.x);\n" +
- " ^\n" +
- "The field E01.x has been deprecated since version 2 and marked for removal\n" +
- "----------\n" +
- "6. ERROR in test1\\E02.java (at line 8)\n" +
- " System.out.println(E01.y);\n" +
- " ^\n" +
- "The field E01.y has been deprecated since version 2 and marked for removal\n" +
- "----------\n" +
- "7. ERROR in test1\\E02.java (at line 10)\n" +
- " class E03 extends E01 {\n" +
- " ^^^\n" +
- "The constructor E01() has been deprecated since version 3.0.0 and marked for removal\n" +
- "----------\n" +
- "8. ERROR in test1\\E02.java (at line 11)\n" +
- " protected void old() {}\n" +
- " ^^^^^\n" +
- "The method E02.E03.old() overrides a method from E01 that has been deprecated since version 4-SNAPSHOT and marked for removal\n" +
+ "----------\n" +
+ "1. ERROR in test1\\E02.java (at line 4)\n" +
+ " System.out.println(new E01.Old());\n" +
+ " ^^^^^^^^^\n" +
+ "The constructor E01.Old() has been deprecated since version 1.0 and marked for removal\n" +
+ "----------\n" +
+ "2. ERROR in test1\\E02.java (at line 4)\n" +
+ " System.out.println(new E01.Old());\n" +
+ " ^^^\n" +
+ "The type E01.Old has been deprecated since version 1.0 and marked for removal\n" +
+ "----------\n" +
+ "3. ERROR in test1\\E02.java (at line 5)\n" +
+ " E01 e = new E01();\n" +
+ " ^^^^^\n" +
+ "The constructor E01() has been deprecated since version 3.0.0 and marked for removal\n" +
+ "----------\n" +
+ "4. ERROR in test1\\E02.java (at line 6)\n" +
+ " e.old();\n" +
+ " ^^^^^\n" +
+ "The method old() from the type E01 has been deprecated since version 4-SNAPSHOT and marked for removal\n" +
+ "----------\n" +
+ "5. ERROR in test1\\E02.java (at line 7)\n" +
+ " System.out.println(E01.x);\n" +
+ " ^\n" +
+ "The field E01.x has been deprecated since version 2 and marked for removal\n" +
+ "----------\n" +
+ "6. ERROR in test1\\E02.java (at line 8)\n" +
+ " System.out.println(E01.y);\n" +
+ " ^\n" +
+ "The field E01.y has been deprecated since version 2 and marked for removal\n" +
+ "----------\n" +
+ "7. ERROR in test1\\E02.java (at line 10)\n" +
+ " class E03 extends E01 {\n" +
+ " ^^^\n" +
+ "The constructor E01() has been deprecated since version 3.0.0 and marked for removal\n" +
+ "----------\n" +
+ "8. ERROR in test1\\E02.java (at line 11)\n" +
+ " protected void old() {}\n" +
+ " ^^^^^\n" +
+ "The method E02.E03.old() overrides a method from E01 that has been deprecated since version 4-SNAPSHOT and marked for removal\n" +
"----------\n";
runner.javacTestOptions =
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError;
@@ -664,26 +664,26 @@ public void testDeprecatedModule() {
"}\n"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. WARNING in module-info.java (at line 2)\n" +
- " requires mod.dep;\n" +
- " ^^^^^^^\n" +
- "The module mod.dep is deprecated\n" +
- "----------\n" +
- "2. WARNING in module-info.java (at line 3)\n" +
- " requires mod.dep.since;\n" +
- " ^^^^^^^^^^^^^\n" +
- "The module mod.dep.since is deprecated since version 42\n" +
- "----------\n" +
- "3. ERROR in module-info.java (at line 4)\n" +
- " requires mod.dep.terminally;\n" +
- " ^^^^^^^^^^^^^^^^^^\n" +
- "The module mod.dep.terminally has been deprecated and marked for removal\n" +
- "----------\n" +
- "4. ERROR in module-info.java (at line 5)\n" +
- " requires mod.dep.since.terminally;\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "The module mod.dep.since.terminally has been deprecated since version 42 and marked for removal\n" +
+ "----------\n" +
+ "1. WARNING in module-info.java (at line 2)\n" +
+ " requires mod.dep;\n" +
+ " ^^^^^^^\n" +
+ "The module mod.dep is deprecated\n" +
+ "----------\n" +
+ "2. WARNING in module-info.java (at line 3)\n" +
+ " requires mod.dep.since;\n" +
+ " ^^^^^^^^^^^^^\n" +
+ "The module mod.dep.since is deprecated since version 42\n" +
+ "----------\n" +
+ "3. ERROR in module-info.java (at line 4)\n" +
+ " requires mod.dep.terminally;\n" +
+ " ^^^^^^^^^^^^^^^^^^\n" +
+ "The module mod.dep.terminally has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "4. ERROR in module-info.java (at line 5)\n" +
+ " requires mod.dep.since.terminally;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The module mod.dep.since.terminally has been deprecated since version 42 and marked for removal\n" +
"----------\n";
runner.runNegativeTest();
}
@@ -743,46 +743,46 @@ public void testDeprecatedProvidedServices() {
"}\n"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. INFO in mod1\\module-info.java (at line 3)\n" +
- " provides p1.IServiceDep with p1impl.ServiceDep;\n" +
- " ^^^^^^^^^^^\n" +
- "The type IServiceDep is deprecated\n" +
- "----------\n" +
- "2. INFO in mod1\\module-info.java (at line 3)\n" +
- " provides p1.IServiceDep with p1impl.ServiceDep;\n" +
- " ^^^^^^^^^^\n" +
- "The type ServiceDep is deprecated\n" +
- "----------\n" +
- "3. INFO in mod1\\module-info.java (at line 4)\n" +
- " provides p1.IServiceDepSince with p1impl.ServiceDepSince;\n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "The type IServiceDepSince is deprecated since version 2\n" +
- "----------\n" +
- "4. INFO in mod1\\module-info.java (at line 4)\n" +
- " provides p1.IServiceDepSince with p1impl.ServiceDepSince;\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "The type ServiceDepSince is deprecated since version 2\n" +
- "----------\n" +
- "5. WARNING in mod1\\module-info.java (at line 5)\n" +
- " provides p1.IServiceTermDep with p1impl.ServiceTermDep;\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "The type IServiceTermDep has been deprecated and marked for removal\n" +
- "----------\n" +
- "6. WARNING in mod1\\module-info.java (at line 5)\n" +
- " provides p1.IServiceTermDep with p1impl.ServiceTermDep;\n" +
- " ^^^^^^^^^^^^^^\n" +
- "The type ServiceTermDep has been deprecated and marked for removal\n" +
- "----------\n" +
- "7. WARNING in mod1\\module-info.java (at line 6)\n" +
- " provides p1.IServiceTermDepSince with p1impl.ServiceTermDepSince;\n" +
- " ^^^^^^^^^^^^^^^^^^^^\n" +
- "The type IServiceTermDepSince has been deprecated since version 3 and marked for removal\n" +
- "----------\n" +
- "8. WARNING in mod1\\module-info.java (at line 6)\n" +
- " provides p1.IServiceTermDepSince with p1impl.ServiceTermDepSince;\n" +
- " ^^^^^^^^^^^^^^^^^^^\n" +
- "The type ServiceTermDepSince has been deprecated since version 3 and marked for removal\n" +
+ "----------\n" +
+ "1. INFO in mod1\\module-info.java (at line 3)\n" +
+ " provides p1.IServiceDep with p1impl.ServiceDep;\n" +
+ " ^^^^^^^^^^^\n" +
+ "The type IServiceDep is deprecated\n" +
+ "----------\n" +
+ "2. INFO in mod1\\module-info.java (at line 3)\n" +
+ " provides p1.IServiceDep with p1impl.ServiceDep;\n" +
+ " ^^^^^^^^^^\n" +
+ "The type ServiceDep is deprecated\n" +
+ "----------\n" +
+ "3. INFO in mod1\\module-info.java (at line 4)\n" +
+ " provides p1.IServiceDepSince with p1impl.ServiceDepSince;\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The type IServiceDepSince is deprecated since version 2\n" +
+ "----------\n" +
+ "4. INFO in mod1\\module-info.java (at line 4)\n" +
+ " provides p1.IServiceDepSince with p1impl.ServiceDepSince;\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "The type ServiceDepSince is deprecated since version 2\n" +
+ "----------\n" +
+ "5. WARNING in mod1\\module-info.java (at line 5)\n" +
+ " provides p1.IServiceTermDep with p1impl.ServiceTermDep;\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "The type IServiceTermDep has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "6. WARNING in mod1\\module-info.java (at line 5)\n" +
+ " provides p1.IServiceTermDep with p1impl.ServiceTermDep;\n" +
+ " ^^^^^^^^^^^^^^\n" +
+ "The type ServiceTermDep has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "7. WARNING in mod1\\module-info.java (at line 6)\n" +
+ " provides p1.IServiceTermDepSince with p1impl.ServiceTermDepSince;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^\n" +
+ "The type IServiceTermDepSince has been deprecated since version 3 and marked for removal\n" +
+ "----------\n" +
+ "8. WARNING in mod1\\module-info.java (at line 6)\n" +
+ " provides p1.IServiceTermDepSince with p1impl.ServiceTermDepSince;\n" +
+ " ^^^^^^^^^^^^^^^^^^^\n" +
+ "The type ServiceTermDepSince has been deprecated since version 3 and marked for removal\n" +
"----------\n";
runner.runWarningTest();
}
@@ -818,7 +818,7 @@ public void testDeprecatedUsedServices() {
"}\n",
};
runner.runConformTest();
-
+
runner.shouldFlushOutputDirectory = false;
runner.testFiles =
new String[] {
@@ -832,26 +832,26 @@ public void testDeprecatedUsedServices() {
"}\n"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. INFO in module-info.java (at line 3)\n" +
- " uses p1.IServiceDep;\n" +
- " ^^^^^^^^^^^\n" +
- "The type IServiceDep is deprecated\n" +
- "----------\n" +
- "2. INFO in module-info.java (at line 4)\n" +
- " uses p1.IServiceDepSince;\n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "The type IServiceDepSince is deprecated since version 2\n" +
- "----------\n" +
- "3. WARNING in module-info.java (at line 5)\n" +
- " uses p1.IServiceTermDep;\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "The type IServiceTermDep has been deprecated and marked for removal\n" +
- "----------\n" +
- "4. WARNING in module-info.java (at line 6)\n" +
- " uses p1.IServiceTermDepSince;\n" +
- " ^^^^^^^^^^^^^^^^^^^^\n" +
- "The type IServiceTermDepSince has been deprecated since version 3 and marked for removal\n" +
+ "----------\n" +
+ "1. INFO in module-info.java (at line 3)\n" +
+ " uses p1.IServiceDep;\n" +
+ " ^^^^^^^^^^^\n" +
+ "The type IServiceDep is deprecated\n" +
+ "----------\n" +
+ "2. INFO in module-info.java (at line 4)\n" +
+ " uses p1.IServiceDepSince;\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The type IServiceDepSince is deprecated since version 2\n" +
+ "----------\n" +
+ "3. WARNING in module-info.java (at line 5)\n" +
+ " uses p1.IServiceTermDep;\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "The type IServiceTermDep has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "4. WARNING in module-info.java (at line 6)\n" +
+ " uses p1.IServiceTermDepSince;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^\n" +
+ "The type IServiceTermDepSince has been deprecated since version 3 and marked for removal\n" +
"----------\n";
runner.runWarningTest();
}
@@ -869,20 +869,20 @@ public void testBug533063_1() throws Exception {
};
if (isJRE11Plus) {
runner.expectedCompilerLog =
- "----------\n" +
- "1. ERROR in module-info.java (at line 2)\n" +
- " requires jdk.xml.bind;\n" +
- " ^^^^^^^^^^^^\n" +
- "jdk.xml.bind cannot be resolved to a module\n" +
+ "----------\n" +
+ "1. ERROR in module-info.java (at line 2)\n" +
+ " requires jdk.xml.bind;\n" +
+ " ^^^^^^^^^^^^\n" +
+ "jdk.xml.bind cannot be resolved to a module\n" +
"----------\n";
runner.runNegativeTest();
} else {
runner.expectedCompilerLog =
- "----------\n" +
- "1. WARNING in module-info.java (at line 2)\n" +
- " requires jdk.xml.bind;\n" +
- " ^^^^^^^^^^^^\n" +
- "The module jdk.xml.bind has been deprecated since version 9 and marked for removal\n" +
+ "----------\n" +
+ "1. WARNING in module-info.java (at line 2)\n" +
+ " requires jdk.xml.bind;\n" +
+ " ^^^^^^^^^^^^\n" +
+ "The module jdk.xml.bind has been deprecated since version 9 and marked for removal\n" +
"----------\n";
runner.runWarningTest();
}
@@ -907,11 +907,11 @@ public void testBug533063_2() throws Exception {
"}\n"
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. WARNING in my.mod\\module-info.java (at line 2)\n" +
- " requires dont.use;\n" +
- " ^^^^^^^^\n" +
- "The module dont.use has been deprecated since version 9 and marked for removal\n" +
+ "----------\n" +
+ "1. WARNING in my.mod\\module-info.java (at line 2)\n" +
+ " requires dont.use;\n" +
+ " ^^^^^^^^\n" +
+ "The module dont.use has been deprecated since version 9 and marked for removal\n" +
"----------\n";
runner.runWarningTest();
}
@@ -919,45 +919,45 @@ public void testBug534304() throws Exception {
runNegativeTest(
new String[] {
"p1/C1.java",
- "package p1;\n" +
- "\n" +
- "import pdep.Dep1;\n" +
- "\n" +
- "public class C1 {\n" +
- " Dep1 f;\n" +
+ "package p1;\n" +
+ "\n" +
+ "import pdep.Dep1;\n" +
+ "\n" +
+ "public class C1 {\n" +
+ " Dep1 f;\n" +
"}\n",
"pdep/Dep1.java",
- "package pdep;\n" +
- "\n" +
- "import pmissing.CMissing;\n" +
- "\n" +
- "@Deprecated(since=\"13\")\n" +
- "@CMissing\n" +
- "public class Dep1 {\n" +
- "\n" +
+ "package pdep;\n" +
+ "\n" +
+ "import pmissing.CMissing;\n" +
+ "\n" +
+ "@Deprecated(since=\"13\")\n" +
+ "@CMissing\n" +
+ "public class Dep1 {\n" +
+ "\n" +
"}\n"
- },
- "----------\n" +
- "1. WARNING in p1\\C1.java (at line 3)\n" +
- " import pdep.Dep1;\n" +
- " ^^^^^^^^^\n" +
- "The type Dep1 is deprecated since version 13\n" +
- "----------\n" +
- "2. WARNING in p1\\C1.java (at line 6)\n" +
- " Dep1 f;\n" +
- " ^^^^\n" +
- "The type Dep1 is deprecated since version 13\n" +
- "----------\n" +
- "----------\n" +
- "1. ERROR in pdep\\Dep1.java (at line 3)\n" +
- " import pmissing.CMissing;\n" +
- " ^^^^^^^^\n" +
- "The import pmissing cannot be resolved\n" +
- "----------\n" +
- "2. ERROR in pdep\\Dep1.java (at line 6)\n" +
- " @CMissing\n" +
- " ^^^^^^^^\n" +
- "CMissing cannot be resolved to a type\n" +
+ },
+ "----------\n" +
+ "1. WARNING in p1\\C1.java (at line 3)\n" +
+ " import pdep.Dep1;\n" +
+ " ^^^^^^^^^\n" +
+ "The type Dep1 is deprecated since version 13\n" +
+ "----------\n" +
+ "2. WARNING in p1\\C1.java (at line 6)\n" +
+ " Dep1 f;\n" +
+ " ^^^^\n" +
+ "The type Dep1 is deprecated since version 13\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in pdep\\Dep1.java (at line 3)\n" +
+ " import pmissing.CMissing;\n" +
+ " ^^^^^^^^\n" +
+ "The import pmissing cannot be resolved\n" +
+ "----------\n" +
+ "2. ERROR in pdep\\Dep1.java (at line 6)\n" +
+ " @CMissing\n" +
+ " ^^^^^^^^\n" +
+ "CMissing cannot be resolved to a type\n" +
"----------\n");
}
public void testBug542795() throws Exception {
@@ -983,30 +983,83 @@ public void testBug542795() throws Exception {
"}\n",
};
runner.expectedCompilerLog =
- "----------\n" +
- "1. ERROR in Test.java (at line 1)\n" +
- " public class Test implements test.Screen.Component {}\n" +
- " ^^^^\n" +
- "The hierarchy of the type Test is inconsistent\n" +
- "----------\n" +
- "2. ERROR in Test.java (at line 1)\n" +
- " public class Test implements test.Screen.Component {}\n" +
- " ^^^^^^\n" +
- "The type Screen is deprecated\n" +
- "----------\n" +
- "3. ERROR in Test.java (at line 1)\n" +
- " public class Test implements test.Screen.Component {}\n" +
- " ^^^^^^^^^\n" +
- "The type Screen.Component is deprecated\n" +
- "----------\n" +
- "----------\n" +
- "1. ERROR in test\\Screen.java (at line 7)\n" +
- " public interface Component extends test.ReaderWarningView.Component {\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "test.ReaderWarningView.Component cannot be resolved to a type\n" +
+ "----------\n" +
+ "1. ERROR in Test.java (at line 1)\n" +
+ " public class Test implements test.Screen.Component {}\n" +
+ " ^^^^\n" +
+ "The hierarchy of the type Test is inconsistent\n" +
+ "----------\n" +
+ "2. ERROR in Test.java (at line 1)\n" +
+ " public class Test implements test.Screen.Component {}\n" +
+ " ^^^^^^\n" +
+ "The type Screen is deprecated\n" +
+ "----------\n" +
+ "3. ERROR in Test.java (at line 1)\n" +
+ " public class Test implements test.Screen.Component {}\n" +
+ " ^^^^^^^^^\n" +
+ "The type Screen.Component is deprecated\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in test\\Screen.java (at line 7)\n" +
+ " public interface Component extends test.ReaderWarningView.Component {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "test.ReaderWarningView.Component cannot be resolved to a type\n" +
"----------\n";
runner.runNegativeTest();
}
+ public void testGH1431() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "Parent.java",
+ """
+ @Deprecated(since = AbstractChild.TEST_CONSTANT) // this now fails
+ public class Parent extends AbstractChild {
+ private static final String REF_OK = AbstractChild.TEST_CONSTANT; // this compiles OK
+ }
+ """,
+ "AbstractChild.java",
+ """
+ public abstract class AbstractChild implements Constants {
+ // redacted for brevity
+ }
+ """,
+ "Constants.java",
+ """
+ public interface Constants {
+ public static final String TEST_CONSTANT = "this is a test";
+ }
+ """
+ };
+ runner.runConformTest();
+ }
+ public void testGH1412() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "AbstractClass.java",
+ """
+ public abstract class AbstractClass {}
+ """,
+ "AnnotationWithClassValue.java",
+ """
+ public @interface AnnotationWithClassValue {
+ Class extends AbstractClass>> value();
+ }
+ """,
+ "ConcreteClass.java",
+ """
+ //Adding @Deprecated here fixes the bug
+ //@Deprecated
+ public class ConcreteClass extends AbstractClass {}
+ """,
+ "AnnotatedClass.java",
+ """
+ @Deprecated
+ @AnnotationWithClassValue(ConcreteClass.class) //Type mismatch: cannot convert from Class to Class extends AbstractClass>>
+ public class AnnotatedClass {}
+ """
+ };
+ runner.runConformTest();
+ }
public static Class> testClass() {
return Deprecated9Test.class;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java
index 19bbb872a0..655ced38cb 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java
@@ -92,8 +92,6 @@ public GenericTypeSignatureTest(String name) {
super(name);
}
- /**
- */
protected void cleanUp() {
Util.flushDirectoryContent(new File(OUTPUT_DIR));
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
index 1634453d8e..8f3aec64cf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
@@ -10495,4 +10495,52 @@ public Parameter(final String name, final String value) {
"""
});
}
+ public void testGH973() {
+ runConformTest(
+ new String[] {
+ "Seq.java",
+ """
+ import java.util.List;
+ import java.util.function.Consumer;
+ import java.util.function.Function;
+
+ public interface Seq {
+
+ void consume(Consumer consumer);
+
+ default Seq map(Function mapFunction) {
+ return c -> consume(t -> c.accept(mapFunction.apply(t)));
+ }
+
+ default Seq flatMap(Function> mapFunction) {
+ return c -> consume(t -> mapFunction.apply(t).consume(c));
+ }
+
+ static void main(String[] args) {
+ Seq seq = List.of(1, 2, 3)::forEach;
+ seq.map(e -> e * 2).flatMap(e -> List.of(e - 1, e)::forEach).consume(System.out::println);
+ }
+
+ }
+ """
+ });
+ }
+ public void testGH1427_class() {
+ runConformTest(
+ new String[] {
+ "Main.java",
+ """
+ import java.util.List;
+ import java.util.function.Supplier;
+
+ public class Main {
+ private static final List>> ATTRIBUTE = List.of(new Pair<>(String::new));
+
+ static class Pair { Pair(T first) {} }
+
+ public static void main(String[] args) {}
+ }
+ """
+ });
+ }
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_9.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_9.java
index 9469484856..15bab7385b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_9.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_9.java
@@ -671,7 +671,7 @@ public void testBug533644() {
runner.runConformTest();
}
//As All non-private methods of an anonymous class instantiated with '<>' must be treated as being annotated with @override,
-//"Remove redundant type arguments" error should be reported if all the non-private methods defined in the anonymous class
+//"Remove redundant type arguments" diagnostic should be reported ONLY if all the non-private methods defined in the anonymous class
//are also present in the parent class.
public void testBug551913_001() {
Map options = getCompilerOptions();
@@ -696,7 +696,7 @@ public void testBug551913_001() {
},"10", options);
}
// As All non-private methods of an anonymous class instantiated with '<>' must be treated as being annotated with @override,
-// "Remove redundant type arguments" error should be reported if all the non-private methods defined in the anonymous class
+// "Remove redundant type arguments" diagnostic should be reported ONLY if all the non-private methods defined in the anonymous class
// are also present in the parent class.
public void testBug551913_002() {
Map options = getCompilerOptions();
@@ -722,6 +722,291 @@ public void testBug551913_002() {
"----------\n",
null, true, options);
}
+
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1506
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=551913
+public void testBug551913_003() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " void foo() {\n" +
+ " java.util.HashSet a = new java.util.HashSet<>();\n" +
+ " java.util.HashSet b = new java.util.HashSet(a) {\n" +
+ " private static final long serialVersionUID = 1L;\n" +
+ " public String toString() {return asString();}\n" +
+ " private String asString() { return null;}\n" +
+ " };\n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " java.util.HashSet b = new java.util.HashSet(a) {\n" +
+ " ^^^^^^^\n" +
+ "Redundant specification of type arguments \n" +
+ "----------\n",
+ null, true, options);
+}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1506
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=551913
+public void testBug551913_004() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " void foo() {\n" +
+ " java.util.HashSet a = new java.util.HashSet<>();\n" +
+ " java.util.HashSet b = new java.util.HashSet(a) {\n" +
+ " private static final long serialVersionUID = 1L;\n" +
+ " public String toString() {return asString();}\n" +
+ " public String asString() { return null;}\n" +
+ " };\n" +
+ " }\n" +
+ "}",
+ },
+ "",
+ null, true, options);
+}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1506
+// Recommendation from compiler to drop type arguments leads to compile error
+public void testGH1506() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "import java.io.File;\n" +
+ "import java.util.Arrays;\n" +
+ "import java.util.Iterator;\n" +
+ "\n" +
+ "public class X {\n" +
+ "\n" +
+ " public Iterable getStackFramesClassesLocations(Object element) {\n" +
+ " return new Iterable() {\n" +
+ " @Override\n" +
+ " public Iterator iterator() {\n" +
+ " return Arrays.stream(new Object[0]) //\n" +
+ " .map(frame -> getClassesLocation(frame)) //\n" +
+ " .iterator();\n" +
+ " }\n" +
+ " \n" +
+ " File getClassesLocation(Object frame) {\n" +
+ " return null;\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ "}\n",
+ },
+ "",
+ null, true, options);
+}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1506
+// Recommendation from compiler to drop type arguments leads to compile error
+public void testGH1506_2() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "import java.io.File;\n" +
+ "import java.util.Arrays;\n" +
+ "import java.util.Iterator;\n" +
+ "\n" +
+ "public class X {\n" +
+ "\n" +
+ " public Iterable getStackFramesClassesLocations(Object element) {\n" +
+ " return new Iterable() {\n" +
+ " @Override\n" +
+ " public Iterator iterator() {\n" +
+ " return Arrays.stream(new Object[0]) //\n" +
+ " .map(frame -> getClassesLocation(frame)) //\n" +
+ " .iterator();\n" +
+ " }\n" +
+ " \n" +
+ " private File getClassesLocation(Object frame) {\n" +
+ " return null;\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n"
+ + "1. ERROR in X.java (at line 8)\n"
+ + " return new Iterable() {\n"
+ + " ^^^^^^^^\n"
+ + "Redundant specification of type arguments \n"
+ + "----------\n",
+ null, true, options);
+}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1506
+// Recommendation from compiler to drop type arguments leads to compile error
+public void testGH1506_3() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static class AX{}\n" +
+ " X(E e) {}\n" +
+ " X() {}\n" +
+ " public static void main(String[] args) {\n" +
+ " X extends AX> x5 = new X>(new AX() { private void foo() {} });\n" +
+ " }\n" +
+ "} \n",
+ },
+ "----------\n"
+ + "1. WARNING in X.java (at line 6)\n"
+ + " X extends AX> x5 = new X>(new AX() { private void foo() {} });\n"
+ + " ^^\n"
+ + "X.AX is a raw type. References to generic type X.AX should be parameterized\n"
+ + "----------\n"
+ + "2. WARNING in X.java (at line 6)\n"
+ + " X extends AX> x5 = new X>(new AX() { private void foo() {} });\n"
+ + " ^^^^^\n"
+ + "The method foo() from the type new X.AX(){} is never used locally\n"
+ + "----------\n",
+ null, true, options);
+}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1506
+// Recommendation from compiler to drop type arguments leads to compile error
+public void testGH1506_4() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " static class AX{}\n" +
+ " X(E e) {}\n" +
+ " X() {}\n" +
+ " public static void main(String[] args) {\n" +
+ " X extends AX> x5 = new X>(new AX() { public void foo() {} });\n" +
+ " }\n" +
+ "} \n",
+ },
+ "----------\n"
+ + "1. WARNING in X.java (at line 6)\n"
+ + " X extends AX> x5 = new X>(new AX() { public void foo() {} });\n"
+ + " ^^\n"
+ + "X.AX is a raw type. References to generic type X.AX should be parameterized\n"
+ + "----------\n"
+ + "2. WARNING in X.java (at line 6)\n"
+ + " X extends AX> x5 = new X>(new AX() { public void foo() {} });\n"
+ + " ^^^^^\n"
+ + "The method foo() from the type new X.AX(){} is never used locally\n"
+ + "----------\n",
+ null, true, options);
+}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1560
+// ECJ recommends diamond when using it would result in non-denotable types.
+public void testGH1560() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ """
+ import java.util.Collection;
+ import java.util.List;
+
+ public class X {
+
+ public interface MMenuElement {}
+ public interface IObservable {}
+ public static class ListDiffVisitor {}
+ public interface IObservablesListener {}
+ public interface IObservableCollection extends IObservable, Collection {}
+ public static class ObservableEvent {}
+ public interface IDiff {}
+ public static class ListDiff implements IDiff {
+ public void accept(ListDiffVisitor super E> visitor) {}
+ }
+ public static class ListChangeEvent extends ObservableEvent {
+ public ListDiff diff;
+ }
+ public interface IListChangeListener extends IObservablesListener {
+ void handleListChange(ListChangeEvent extends E> event);
+ }
+ public interface IObservableList extends List, IObservableCollection {
+ void addListChangeListener(IListChangeListener super E> listener);
+ }
+
+ public void foo() {
+
+ IObservableList l;
+
+ l.addListChangeListener(event -> event.diff.accept(new ListDiffVisitor() {})); // <> should not be recommended here!!!
+
+ }
+ }
+ """,
+ },
+ "----------\n"
+ + "1. ERROR in X.java (at line 30)\n"
+ + " l.addListChangeListener(event -> event.diff.accept(new ListDiffVisitor() {})); // <> should not be recommended here!!!\n"
+ + " ^\n"
+ + "The local variable l may not have been initialized\n"
+ + "----------\n",
+ null, true, options);
+}
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1560
+// ECJ recommends diamond when using it would result in non-denotable types.
+public void testGH1560_2() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportRedundantSpecificationOfTypeArguments, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ """
+ import java.util.Collection;
+ import java.util.List;
+
+ public class X {
+
+ public interface MMenuElement {}
+ public interface IObservable {}
+ public static class ListDiffVisitor {}
+ public interface IObservablesListener {}
+ public interface IObservableCollection extends IObservable, Collection {}
+ public static class ObservableEvent {}
+ public interface IDiff {}
+ public static class ListDiff implements IDiff {
+ public void accept(ListDiffVisitor super E> visitor) {}
+ }
+ public static class ListChangeEvent extends ObservableEvent {
+ public ListDiff diff;
+ }
+ public interface IListChangeListener extends IObservablesListener {
+ void handleListChange(ListChangeEvent extends E> event);
+ }
+ public interface IObservableList extends List, IObservableCollection {
+ void addListChangeListener(IListChangeListener super E> listener);
+ }
+
+ public void foo() {
+
+ IObservableList l;
+
+ l.addListChangeListener(event -> event.diff.accept(new ListDiffVisitor<>() {})); // non-denotable type error
+
+ }
+ }
+ """,
+ },
+ "----------\n"
+ + "1. ERROR in X.java (at line 30)\n"
+ + " l.addListChangeListener(event -> event.diff.accept(new ListDiffVisitor<>() {})); // non-denotable type error\n"
+ + " ^^^^^^^^^^^^^^^\n"
+ + "Type X.ListDiffVisitor inferred for ListDiffVisitor<>, is not valid for an anonymous class with '<>'\n"
+ + "----------\n",
+ null, true, options);
+}
public static Class testClass() {
return GenericsRegressionTest_9.class;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java
index c3ba04082b..d5bd847356 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java
@@ -52,8 +52,6 @@ public static Class testClass() {
return InternalHexFloatTest.class;
}
- /**
- */
public void test001() {
List x = new ArrayList();
@@ -187,8 +185,6 @@ public void test001() {
}
}
- /**
- */
public void test002() {
List x = new ArrayList();
// various forms of zero
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
index 485a6317dc..9ab267f732 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java
@@ -134,9 +134,6 @@ public void test003() {
"SUCCESS"
);
}
-/**
- *
- */
public void test004() {
this.runConformTest(
new String[] {
@@ -174,9 +171,6 @@ public void test004() {
"SUCCESS"
);
}
-/**
- *
- */
public void test005() {
this.runConformTest(
new String[] {
@@ -359,9 +353,6 @@ public void test010() {
"Cannot make a static reference to the non-static field A.success\n" +
"----------\n");
}
-/**
- *
- */
public void test011() {
this.runNegativeTest(
new String[] {
@@ -399,9 +390,6 @@ public void test011() {
"----------\n"
);
}
-/**
- *
- */
public void test012() {
this.runConformTest(
new String[] {
@@ -428,9 +416,6 @@ public void test012() {
"SUCCESS"
);
}
-/**
- *
- */
public void test013() {
this.runNegativeTest(
new String[] {
@@ -485,9 +470,6 @@ public void test013() {
"----------\n"
);
}
-/**
- *
- */
public void test014() {
this.runNegativeTest(
new String[] {
@@ -512,9 +494,6 @@ public void test014() {
"----------\n"
);
}
-/**
- *
- */
public void test015() {
this.runConformTest(
new String[] {
@@ -535,9 +514,6 @@ public void test015() {
"SUCCESS"
);
}
-/**
- *
- */
public void test016() {
this.runConformTest(
new String[] {
@@ -583,9 +559,6 @@ public void test016() {
}
);
}
-/**
- *
- */
public void test017() {
this.runConformTest(
new String[] {
@@ -751,9 +724,6 @@ public void test021() {
}
);
}
-/**
- *
- */
public void test022() {
this.runConformTest(
new String[] {
@@ -791,9 +761,6 @@ public void test022() {
}
);
}
-/**
- *
- */
public void test023() {
this.runConformTest(
new String[] {
@@ -820,9 +787,6 @@ public void test023() {
}
);
}
-/**
- *
- */
public void test024() {
this.runConformTest(
new String[] {
@@ -847,9 +811,6 @@ public void test024() {
}
);
}
-/**
- *
- */
public void test025() {
this.runConformTest(
new String[] {
@@ -887,9 +848,6 @@ public void test025() {
"SUCCESS"
);
}
-/**
- *
- */
public void test026() {
this.runNegativeTest(
new String[] {
@@ -930,9 +888,6 @@ public void test026() {
"The field A.B.B is not visible\n" +
"----------\n");
}
-/**
- *
- */
public void test027() {
this.runNegativeTest(
new String[] {
@@ -974,9 +929,6 @@ public void test027() {
"----------\n"
);
}
-/**
- *
- */
public void test028() {
this.runConformTest(
new String[] {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java
index 784a5a00f6..a3362d0513 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java
@@ -1223,4 +1223,159 @@ public void testGH703() {
"",
true);
}
+ public void testGH1452_src() throws IOException {
+ String annotationPath = "/annotations";
+ new File(OUTPUT_DIR+annotationPath+"/some/sillyPackage").mkdirs();
+ Util.createFile(OUTPUT_DIR+annotationPath+"/some/sillyPackage/Foo.eea",
+ "class some/sillyPackage/Foo\n" +
+ "get\n" +
+ " (Ljava/lang/String;)Ljava/lang/String;\n" +
+ " (L1java/lang/String;)L0java/lang/String;\n");
+
+ String[] testFiles = new String[] {
+ "java/lang/annotation/ElementType.java",
+ ELEMENT_TYPE_18_CONTENT,
+ "org/eclipse/jdt/annotation/NonNull.java",
+ NONNULL_ANNOTATION_18_CONTENT,
+ "org/eclipse/jdt/annotation/Nullable.java",
+ NULLABLE_ANNOTATION_18_CONTENT,
+ "org/eclipse/jdt/annotation/DefaultLocation.java",
+ DEFAULT_LOCATION_CONTENT,
+ "org/eclipse/jdt/annotation/NonNullByDefault.java",
+ NONNULL_BY_DEFAULT_ANNOTATION_18_CONTENT,
+ "sillyPackage/Foo.java",
+ "package some.sillyPackage;\n" +
+ "public class Foo {\n" +
+ " public String get(String s) { return null; }\n" +
+ "}\n",
+ "test1/Test1.java",
+ "package test1;\n" +
+ "\n" +
+ "import some.sillyPackage.Foo;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "@NonNullByDefault\n" +
+ "public class Test1 {\n" +
+ " void test(Foo f) {\n" +
+ " System.out.print(f.get(null).toUpperCase());\n" +
+ " }\n" +
+ "}\n"
+ };
+
+ String o_e_j_annotation_dir = OUTPUT_DIR + File.separator +
+ "org" + File.separator + "eclipse" + File.separator + "jdt" + File.separator + "annotation";
+ String j_l_annotation_dir = OUTPUT_DIR + File.separator +
+ "java" + File.separator + "lang" + File.separator + "annotation";
+
+ String commandLine = " -1.8 -proc:none -d none -err:+nullAnnot,null -annotationpath CLASSPATH " +
+ " -classpath \"" + OUTPUT_DIR + annotationPath +"\" " +
+ // explicitly mention all files to ensure a good order, cannot pull in source of NNBD on demand
+ "\"" + j_l_annotation_dir + File.separator + "ElementType.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "NonNull.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "Nullable.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "DefaultLocation.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "NonNullByDefault.java\" " +
+ "\"" + OUTPUT_DIR + File.separator + "sillyPackage" + File.separator + "Foo.java\" " +
+ "\"" + OUTPUT_DIR + File.separator + "test1" + File.separator + "Test1.java\"";
+
+ String expectedCompilerMessage =
+ "----------\n" +
+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/test1/Test1.java (at line 9)\n" +
+ " System.out.print(f.get(null).toUpperCase());\n" +
+ " ^^^^^^^^^^^\n" +
+ "Potential null pointer access: The method get(String) may return null\n" +
+ "----------\n" +
+ "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/test1/Test1.java (at line 9)\n" +
+ " System.out.print(f.get(null).toUpperCase());\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'@NonNull String\' but the provided value is null\n" +
+ "----------\n" +
+ "2 problems (2 errors)\n";
+ try {
+ this.runNegativeTest(testFiles, commandLine, "", expectedCompilerMessage, false);
+ } finally {
+ Util.delete(Util.getOutputDirectory());
+ }
+ }
+ public void testGH1452_bin() throws IOException {
+ String jarPath = OUTPUT_DIR+"/lib.jar";
+ String annotationZip = OUTPUT_DIR+"/annotations.zip";
+ Util.createJar(new String[] {
+ "some/sillyPackage/Foo.java",
+ "package some.sillyPackage;\n" +
+ "public class Foo {\n" +
+ " public String get(String s) { return null; }\n" +
+ "}\n"
+ },
+ jarPath,
+ "1.8");
+ Util.createSourceZip(
+ new String[] {
+ "some/sillyPackage/Foo.eea",
+ "class some/sillyPackage/Foo\n" +
+ "get\n" +
+ " (Ljava/lang/String;)Ljava/lang/String;\n" +
+ " (L1java/lang/String;)L0java/lang/String;\n"
+ },
+ annotationZip);
+
+ String[] testFiles = new String[] {
+ "java/lang/annotation/ElementType.java",
+ ELEMENT_TYPE_18_CONTENT,
+ "org/eclipse/jdt/annotation/NonNull.java",
+ NONNULL_ANNOTATION_18_CONTENT,
+ "org/eclipse/jdt/annotation/Nullable.java",
+ NULLABLE_ANNOTATION_18_CONTENT,
+ "org/eclipse/jdt/annotation/DefaultLocation.java",
+ DEFAULT_LOCATION_CONTENT,
+ "org/eclipse/jdt/annotation/NonNullByDefault.java",
+ NONNULL_BY_DEFAULT_ANNOTATION_18_CONTENT,
+ "test1/Test1.java",
+ "package test1;\n" +
+ "\n" +
+ "import some.sillyPackage.Foo;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "@NonNullByDefault\n" +
+ "public class Test1 {\n" +
+ " void test(Foo f) {\n" +
+ " System.out.print(f.get(null).toUpperCase());\n" +
+ " }\n" +
+ "}\n"
+ };
+
+ String o_e_j_annotation_dir = OUTPUT_DIR + File.separator +
+ "org" + File.separator + "eclipse" + File.separator + "jdt" + File.separator + "annotation";
+ String j_l_annotation_dir = OUTPUT_DIR + File.separator +
+ "java" + File.separator + "lang" + File.separator + "annotation";
+
+ String commandLine = " -1.8 -proc:none -d none -err:+nullAnnot,null -annotationpath CLASSPATH " +
+ " -classpath \"" + annotationZip +"\""+ File.pathSeparator + "\"" + jarPath + "\" " +
+ // explicitly mention all files to ensure a good order, cannot pull in source of NNBD on demand
+ "\"" + j_l_annotation_dir + File.separator + "ElementType.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "NonNull.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "Nullable.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "DefaultLocation.java\" " +
+ "\"" + o_e_j_annotation_dir + File.separator + "NonNullByDefault.java\" " +
+ "\"" + OUTPUT_DIR + File.separator + "test1" + File.separator + "Test1.java\"";
+
+ String expectedCompilerMessage =
+ "----------\n" +
+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/test1/Test1.java (at line 9)\n" +
+ " System.out.print(f.get(null).toUpperCase());\n" +
+ " ^^^^^^^^^^^\n" +
+ "Potential null pointer access: The method get(String) may return null\n" +
+ "----------\n" +
+ "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/test1/Test1.java (at line 9)\n" +
+ " System.out.print(f.get(null).toUpperCase());\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'@NonNull String\' but the provided value is null\n" +
+ "----------\n" +
+ "2 problems (2 errors)\n";
+ try {
+ this.runNegativeTest(testFiles, commandLine, "", expectedCompilerMessage, false);
+ } finally {
+ Util.delete(Util.getOutputDirectory());
+ }
+ }
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
index 24c106ebb4..0af7669129 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
@@ -4567,7 +4567,7 @@ public void test_nonnull_field_16() {
"----------\n");
}
-// Using javax.inject.Inject, slight variations
+// Using jakarta.inject.Inject, slight variations
// [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=400421
public void test_nonnull_field_17() {
@@ -4577,7 +4577,7 @@ public void test_nonnull_field_17() {
JAVAX_INJECT_CONTENT,
"X.java",
"import org.eclipse.jdt.annotation.*;\n" +
- "import javax.inject.Inject;\n" +
+ "import jakarta.inject.Inject;\n" +
"public class X {\n" +
" @NonNull @Inject static String s; // warn since injection of static field is less reliable\n" + // variation: static field
" @NonNull @Inject @Deprecated Object o;\n" +
@@ -8764,12 +8764,12 @@ public void testBug418236() {
}
public void testBug461878() {
Map compilerOptions = getCompilerOptions();
- compilerOptions.put(JavaCore.COMPILER_NONNULL_ANNOTATION_NAME, "javax.annotation.Nonnull");
+ compilerOptions.put(JavaCore.COMPILER_NONNULL_ANNOTATION_NAME, "jakarta.annotation.Nonnull");
runNegativeTest(
true, /*flush*/
new String[] {
- "javax/annotation/Nonnull.java",
- "package javax.annotation;\n" +
+ "jakarta/annotation/Nonnull.java",
+ "package jakarta.annotation;\n" +
"import java.lang.annotation.Retention;\n" +
"import java.lang.annotation.RetentionPolicy;\n" +
"@Retention(RetentionPolicy.RUNTIME)\n" +
@@ -8777,7 +8777,7 @@ public void testBug461878() {
"}\n",
"edu/umd/cs/findbugs/annotations/PossiblyNull.java",
"package edu.umd.cs.findbugs.annotations;\n" +
- "@javax.annotation.Nonnull // <-- error!!!\n" +
+ "@jakarta.annotation.Nonnull // <-- error!!!\n" +
"public @interface PossiblyNull {\n" +
"}\n"
},
@@ -8785,8 +8785,8 @@ public void testBug461878() {
compilerOptions,
"----------\n" +
"1. WARNING in edu\\umd\\cs\\findbugs\\annotations\\PossiblyNull.java (at line 2)\n" +
- " @javax.annotation.Nonnull // <-- error!!!\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ " @jakarta.annotation.Nonnull // <-- error!!!\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The nullness annotation \'Nonnull\' is not applicable at this location\n" +
"----------\n",
JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java
index 918970df1c..49581cdb37 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java
@@ -1741,7 +1741,7 @@ public void testRemoveNamedRecordPatterns_001() {
"----------\n");
}
public void testEnhancedForWithRecordPattern_001() {
- runConformTest(new String[] {
+ runNegativeTest(new String[] {
"X.java",
"import java.util.ArrayList;\n" +
"import java.util.List;\n" +
@@ -1760,11 +1760,15 @@ public void testEnhancedForWithRecordPattern_001() {
"}\n" +
"record R(Integer i) {}"
},
- "1\n" +
- "2");
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " for (R(Integer a) : rList) { \n" +
+ " ^^^^^^^^^^^^\n" +
+ "Syntax error, record patterns are not allowed here\n" +
+ "----------\n");
}
public void testEnhancedForWithRecordPattern_002() {
- runConformTest(new String[] {
+ runNegativeTest(new String[] {
"X.java",
"public class X {\n" +
" public static boolean foo() {\n" +
@@ -1781,7 +1785,12 @@ public void testEnhancedForWithRecordPattern_002() {
"}\n" +
"record R(int i) {}"
},
- "true");
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " for (R(int x) : recArray) {\n" +
+ " ^^^^^^^^\n" +
+ "Syntax error, record patterns are not allowed here\n" +
+ "----------\n");
}
public void testRecordPatternTypeInference_001() {
runNegativeTest(new String[] {
@@ -2029,7 +2038,12 @@ public void testIssue882() {
+ "}"
},
"----------\n" +
- "1. ERROR in X.java (at line 8)\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " for(R(Integer abcs):rList) {\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "Syntax error, record patterns are not allowed here\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 8)\n" +
" zork();\n" +
" ^^^^\n" +
"The method zork() is undefined for the type X\n" +
@@ -2292,10 +2306,15 @@ public void testIssue945_1() {
" R99[] array = {new R99(new R98(new R97(new R96(new R95(new R94(new R93(new R92(new R91(new R90(new R89(new R88(new R87(new R86(new R85(new R84(new R83(new R82(new R81(new R80(new R79(new R78(new R77(new R76(new R75(new R74(new R73(new R72(new R71(new R70(new R69(new R68(new R67(new R66(new R65(new R64(new R63(new R62(new R61(new R60(new R59(new R58(new R57(new R56(new R55(new R54(new R53(new R52(new R51(new R50(new R49(new R48(new R47(new R46(new R45(new R44(new R43(new R42(new R41(new R40(new R39(new R38(new R37(new R36(new R35(new R34(new R33(new R32(new R31(new R30(new R29(new R28(new R27(new R26(new R25(new R24(new R23(new R22(new R21(new R20(new R19(new R18(new R17(new R16(new R15(new R14(new R13(new R12(new R11(new R10(new R9(new R8(new R7(new R6(new R5(new R4(new R3(new R2(new R1(new R0(\"\"), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99)};\n" +
" ^^^^^^^^^^\n" +
"The constructor X.R0(String) is undefined\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 105)\n" +
+ " for (R99(R98(R97(R96(R95(R94(R93(R92(R91(R90(R89(R88(R87(R86(R85(R84(R83(R82(R81(R80(R79(R78(R77(R76(R75(R74(R73(R72(R71(R70(R69(R68(R67(R66(R65(R64(R63(R62(R61(R60(R59(R58(R57(R56(R55(R54(R53(R52(R51(R50(R49(R48(R47(R46(R45(R44(R43(R42(R41(R40(R39(R38(R37(R36(R35(R34(R33(R32(R31(R30(R29(R28(R27(R26(R25(R24(R23(R22(R21(R20(R19(R18(R17(R16(R15(R14(R13(R12(R11(R10(R9(R8(R7(R6(R5(R4(R3(R2(R1(R0(int i0), int i1), int i2), int i3), int i4), int i5), int i6), int i7), int i8), int i9), int i10), int i11), int i12), int i13), int i14), int i15), int i16), int i17), int i18), int i19), int i20), int i21), int i22), int i23), int i24), int i25), int i26), int i27), int i28), int i29), int i30), int i31), int i32), int i33), int i34), int i35), int i36), int i37), int i38), int i39), int i40), int i41), int i42), int i43), int i44), int i45), int i46), int i47), int i48), int i49), int i50), int i51), int i52), int i53), int i54), int i55), int i56), int i57), int i58), int i59), int i60), int i61), int i62), int i63), int i64), int i65), int i66), int i67), int i68), int i69), int i70), int i71), int i72), int i73), int i74), int i75), int i76), int i77), int i78), int i79), int i80), int i81), int i82), int i83), int i84), int i85), int i86), int i87), int i88), int i89), int i90), int i91), int i92), int i93), int i94), int i95), int i96), int i97), int i98), int i99) : array) {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Syntax error, record patterns are not allowed here\n" +
"----------\n");
}
public void testIssue945_2() {
- runConformTest(new String[] {
+ runNegativeTest(new String[] {
"X.java",
"public class X {\n"
+ " record R0(int x) {}\n"
@@ -2409,7 +2428,12 @@ public void testIssue945_2() {
+ " }\n"
+ "} "
},
- "true");
+ "----------\n" +
+ "1. ERROR in X.java (at line 106)\n" +
+ " for (R99(R98(R97(R96(R95(R94(R93(R92(R91(R90(R89(R88(R87(R86(R85(R84(R83(R82(R81(R80(R79(R78(R77(R76(R75(R74(R73(R72(R71(R70(R69(R68(R67(R66(R65(R64(R63(R62(R61(R60(R59(R58(R57(R56(R55(R54(R53(R52(R51(R50(R49(R48(R47(R46(R45(R44(R43(R42(R41(R40(R39(R38(R37(R36(R35(R34(R33(R32(R31(R30(R29(R28(R27(R26(R25(R24(R23(R22(R21(R20(R19(R18(R17(R16(R15(R14(R13(R12(R11(R10(R9(R8(R7(R6(R5(R4(R3(R2(R1(R0(int i0), int i1), int i2), int i3), int i4), int i5), int i6), int i7), int i8), int i9), int i10), int i11), int i12), int i13), int i14), int i15), int i16), int i17), int i18), int i19), int i20), int i21), int i22), int i23), int i24), int i25), int i26), int i27), int i28), int i29), int i30), int i31), int i32), int i33), int i34), int i35), int i36), int i37), int i38), int i39), int i40), int i41), int i42), int i43), int i44), int i45), int i46), int i47), int i48), int i49), int i50), int i51), int i52), int i53), int i54), int i55), int i56), int i57), int i58), int i59), int i60), int i61), int i62), int i63), int i64), int i65), int i66), int i67), int i68), int i69), int i70), int i71), int i72), int i73), int i74), int i75), int i76), int i77), int i78), int i79), int i80), int i81), int i82), int i83), int i84), int i85), int i86), int i87), int i88), int i89), int i90), int i91), int i92), int i93), int i94), int i95), int i96), int i97), int i98), int i99) : array) {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Syntax error, record patterns are not allowed here\n" +
+ "----------\n");
}
public void testRecordPatternMatchException_001() {
runConformTest(new String[] {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
index 525e69ceff..ad68f42086 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019, 2022 IBM Corporation and others.
+ * Copyright (c) 2019, 2023 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,7 @@ public class RecordsRestrictedClassTest extends AbstractRegressionTest {
static {
// TESTS_NUMBERS = new int [] { 40 };
// TESTS_RANGE = new int[] { 1, -1 };
-// TESTS_NAMES = new String[] { "testBug577251_001"};
+// TESTS_NAMES = new String[] { "testIssue1218_001"};
}
public static Class> testClass() {
@@ -9436,4 +9436,24 @@ record MyRecord(int field1, int field2) {
}
"""});
}
+public void testIssue1218_001() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " record R(T x);\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " record R(T x);\n" +
+ " ^\n" +
+ "Cannot make a static reference to the non-static type T\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 2)\n" +
+ " record R(T x);\n" +
+ " ^\n" +
+ "Syntax error, insert \"RecordBody\" to complete ClassBodyDeclarations\n" +
+ "----------\n");
+}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java
index 5388cfcb40..9e410ffeef 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java
@@ -26,7 +26,7 @@
public class Requestor implements ICompilerRequestor {
public boolean hasErrors = false;
public String outputPath;
- private boolean forceOutputGeneration;
+ private final boolean forceOutputGeneration;
public Hashtable expectedProblems = new Hashtable();
public String problemLog = "";
public ICompilerRequestor clientRequestor;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
index 7e16430b15..ad93939506 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
@@ -1790,28 +1790,6 @@ public void testModule() { // insufficient context, all module words are identif
assertTrue(false);
}
}
- public void testWhenOK() {
- String source = ("public void foo(Object obj) {\n switch(obj) {\n case String s when s.length() > 0 -> {}\n}\n}");
- IScanner scanner = ToolFactory.createScanner(false, true, false, "21", "21", false);
- scanner.setSource(source.toCharArray());
- scanner.resetTo(source.indexOf("when")-1, source.length() - 1); // start directly at "when"
- try {
- int token;
- while ((token = scanner.getNextToken()) != ITerminalSymbols.TokenNameEOF) {
- switch (token) {
- case ITerminalSymbols.TokenNameWHITESPACE:
- break;
- case ITerminalSymbols.TokenNameRestrictedIdentifierWhen:
- return; // success
- default:
- fail("Unexpected token "+token);
- }
- }
- fail("TokenNameRestrictedIdentifierYield was not detected");
- } catch (InvalidInputException e) {
- assertTrue(false);
- }
- }
@SuppressWarnings("deprecation")
public void testWhenKO() {
String source = ("public void foo(Object obj) {\n switch(obj) {\n case String s when s.length() > 0 -> {}\n}\n}");
@@ -1857,4 +1835,24 @@ public void testWhenAsIdentifier() {
assertTrue(false);
}
}
+
+ public void testTerminalTokensAPIs() {
+ char [][] ids = { "when".toCharArray(), "record".toCharArray(), "sealed".toCharArray(),
+ "permits".toCharArray(), "yield".toCharArray()};
+ int [] reskw = { TerminalTokens.TokenNameRestrictedIdentifierWhen,
+ TerminalTokens.TokenNameRestrictedIdentifierrecord,
+ TerminalTokens.TokenNameRestrictedIdentifiersealed,
+ TerminalTokens.TokenNameRestrictedIdentifierpermits,
+ TerminalTokens.TokenNameRestrictedIdentifierYield,};
+ int i = -1;
+ for (char [] id : ids) {
+ i++;
+ int t = TerminalTokens.getRestrictedKeyword(id);
+ assertTrue(t != TerminalTokens.TokenNameNotAToken);
+ assertTrue(TerminalTokens.isRestrictedKeyword(t));
+ assertTrue(t == reskw[i]);
+ }
+ assertTrue(TerminalTokens.getRestrictedKeyword("When".toCharArray()) == TerminalTokens.TokenNameNotAToken);
+ assertTrue(TerminalTokens.getRestrictedKeyword("blah".toCharArray()) == TerminalTokens.TokenNameNotAToken);
+ }
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypesTests.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypesTests.java
index 6d6c04c091..7321384dd5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypesTests.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypesTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2020, 2022 IBM Corporation and others.
+ * Copyright (c) 2020, 2023 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,7 +31,7 @@ public class SealedTypesTests extends AbstractRegressionTest9 {
static {
// TESTS_NUMBERS = new int [] { 40 };
// TESTS_RANGE = new int[] { 1, -1 };
-// TESTS_NAMES = new String[] { "testBug564638_056"};
+// TESTS_NAMES = new String[] { "testBug564498_6"};
}
public static Class> testClass() {
@@ -1611,12 +1611,7 @@ public void testBug564498_5() throws IOException, ClassFormatException {
"}",
},
"----------\n" +
- "1. ERROR in p1\\X.java (at line 6)\n" +
- " sealed class Y extends X permits SubInnerY {\n" +
- " ^^^^^^^^^\n" +
- "SubInnerY cannot be resolved to a type\n" +
- "----------\n" +
- "2. ERROR in p1\\X.java (at line 7)\n" +
+ "1. ERROR in p1\\X.java (at line 7)\n" +
" final class SubInnerY extends Y {}\n" +
" ^\n" +
"The type SubInnerY extending a sealed class A.Y should be a permitted subtype of A.Y\n" +
@@ -5711,12 +5706,7 @@ public void testBug573450_005() {
"}"
},
"----------\n"
- + "1. ERROR in X.java (at line 1)\n"
- + " public sealed class X permits Y {\n"
- + " ^\n"
- + "Y cannot be resolved to a type\n"
- + "----------\n"
- + "2. ERROR in X.java (at line 2)\n"
+ + "1. ERROR in X.java (at line 2)\n"
+ " final class Y extends X {}\n"
+ " ^\n"
+ "The type Y extending a sealed class X should be a permitted subtype of X\n"
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
index d76b71d28d..96a3cf3582 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
@@ -498,46 +498,46 @@ public void test013() {
" public static class WW { public static final int WWW = 0; }\n" +
"}\n",
},
- "----------\n" +
- "1. ERROR in X.java (at line 6)\n" +
- " import static p.Y.Zz;\n" +
- " ^^^^^^\n" +
- "The import p.Y.Zz cannot be resolved\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 7)\n" +
- " import static p.Z.Zz.WW.*;\n" +
- " ^^^^^^^^^\n" +
- "The import p.Z.Zz.WW cannot be resolved\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 8)\n" +
- " import p.Y.ZZ;\n" +
- " ^^^^^^\n" +
- "The import p.Y.ZZ cannot be resolved\n" +
- "----------\n" +
- "4. ERROR in X.java (at line 9)\n" +
- " import static p.Y.ZZ.*;\n" +
- " ^^^^^^\n" +
- "The import p.Y.ZZ cannot be resolved\n" +
- "----------\n" +
- "5. ERROR in X.java (at line 10)\n" +
- " import static p.Y.ZZ.WW;\n" +
- " ^^^^^^\n" +
- "The import p.Y.ZZ cannot be resolved\n" +
- "----------\n" +
- "6. ERROR in X.java (at line 11)\n" +
- " import static p.Y.ZZ.WW.*;\n" +
- " ^^^^^^\n" +
- "The import p.Y.ZZ cannot be resolved\n" +
- "----------\n" +
- "7. ERROR in X.java (at line 12)\n" +
- " import static p.Y.ZZ.ZZZ;\n" +
- " ^^^^^^\n" +
- "The import p.Y.ZZ cannot be resolved\n" +
- "----------\n" +
- "8. ERROR in X.java (at line 13)\n" +
- " import static p.Y.ZZ.WW.WWW;\n" +
- " ^^^^^^\n" +
- "The import p.Y.ZZ cannot be resolved\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " import static p.Y.Zz;\n" +
+ " ^^^^^^\n" +
+ "The import p.Y.Zz cannot be resolved\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 7)\n" +
+ " import static p.Z.Zz.WW.*;\n" +
+ " ^^^^^^^^^\n" +
+ "The import p.Z.Zz.WW cannot be resolved\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 8)\n" +
+ " import p.Y.ZZ;\n" +
+ " ^^^^^^\n" +
+ "The import p.Y.ZZ cannot be resolved\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 9)\n" +
+ " import static p.Y.ZZ.*;\n" +
+ " ^^^^^^\n" +
+ "The import p.Y.ZZ cannot be resolved\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 10)\n" +
+ " import static p.Y.ZZ.WW;\n" +
+ " ^^^^^^\n" +
+ "The import p.Y.ZZ cannot be resolved\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 11)\n" +
+ " import static p.Y.ZZ.WW.*;\n" +
+ " ^^^^^^\n" +
+ "The import p.Y.ZZ cannot be resolved\n" +
+ "----------\n" +
+ "7. ERROR in X.java (at line 12)\n" +
+ " import static p.Y.ZZ.ZZZ;\n" +
+ " ^^^^^^\n" +
+ "The import p.Y.ZZ cannot be resolved\n" +
+ "----------\n" +
+ "8. ERROR in X.java (at line 13)\n" +
+ " import static p.Y.ZZ.WW.WWW;\n" +
+ " ^^^^^^\n" +
+ "The import p.Y.ZZ cannot be resolved\n" +
"----------\n"
);
}
@@ -827,18 +827,18 @@ public void test022() { // test field/method collisions
"package p;\n" +
"public class B { public static int F = 2; }\n",
},
- this.complianceLevel < ClassFileConstants.JDK1_8 ?
+ this.complianceLevel < ClassFileConstants.JDK1_8 ?
"----------\n" +
"1. ERROR in X.java (at line 2)\n" +
" import static p.B.F;\n" +
" ^^^^^\n" +
"The import p.B.F collides with another import statement\n" +
"----------\n" :
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " int i = F;\n" +
- " ^\n" +
- "The field F is ambiguous\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " int i = F;\n" +
+ " ^\n" +
+ "The field F is ambiguous\n" +
"----------\n"
// F is already defined in a single-type import
);
@@ -2426,51 +2426,51 @@ public void test070() {
this.runConformTest(
new String[] {
"node/Test.java",//------------------------------
- "package node;\n" +
- "public class Test {\n" +
- " public static void node() {}\n" +
+ "package node;\n" +
+ "public class Test {\n" +
+ " public static void node() {}\n" +
"}\n",
"node2/Test2.java",//------------------------------
- "package node2;\n" +
- "import static node.Test.node;\n" +
- "public class Test2 {\n" +
+ "package node2;\n" +
+ "import static node.Test.node;\n" +
+ "public class Test2 {\n" +
"}\n",
},
"");
- }
+ }
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=250211 - variation
public void test071() {
this.runNegativeTest(
new String[] {
"node/Test/node.java",//------------------------------
- "package node.Test;\n" +
- "public class node {\n" +
- "}\n",
+ "package node.Test;\n" +
+ "public class node {\n" +
+ "}\n",
"node/Test.java",//------------------------------
- "package node;\n" +
- "public class Test {\n" +
- " public static void node() {}\n" +
+ "package node;\n" +
+ "public class Test {\n" +
+ " public static void node() {}\n" +
"}\n",
"node2/Test2.java",//------------------------------
- "package node2;\n" +
+ "package node2;\n" +
"import node.Test;\n" +
- "import static Test.node;\n" +
- "public class Test2 {\n" +
- "}\n",
- },
- "----------\n" +
- "1. ERROR in node\\Test.java (at line 2)\n" +
- " public class Test {\n" +
- " ^^^^\n" +
- "The type Test collides with a package\n" +
- "----------\n" +
- "----------\n" +
- "1. ERROR in node2\\Test2.java (at line 3)\n" +
- " import static Test.node;\n" +
- " ^^^^\n" +
- "The import Test cannot be resolved\n" +
+ "import static Test.node;\n" +
+ "public class Test2 {\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in node\\Test.java (at line 2)\n" +
+ " public class Test {\n" +
+ " ^^^^\n" +
+ "The type Test collides with a package\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in node2\\Test2.java (at line 3)\n" +
+ " import static Test.node;\n" +
+ " ^^^^\n" +
+ "The import Test cannot be resolved\n" +
"----------\n");
- }
+ }
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=93913 - variation
public void test072() {
this.runNegativeTest(
@@ -2499,57 +2499,57 @@ public void test072() {
" public static int B;\n" +
"}\n",
},
- "----------\n" +
- "1. ERROR in p1\\A.java (at line 6)\n" +
- " int v1 = b.fooB;\n" +
- " ^^^^\n" +
- "fooB cannot be resolved or is not a field\n" +
+ "----------\n" +
+ "1. ERROR in p1\\A.java (at line 6)\n" +
+ " int v1 = b.fooB;\n" +
+ " ^^^^\n" +
+ "fooB cannot be resolved or is not a field\n" +
"----------\n");
- }
+ }
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=256375
public void test073() {
this.runNegativeTest(
new String[] {
"test/Outer.java",
- "package test;\n" +
- "import static test.Outer.Inner.VALUE;\n" +
- "public class Outer {\n" +
- " int i = VALUE;\n" +
- " int i2 = Inner.VALUE;\n" +
- " static class Inner {\n" +
- " private static final int VALUE = 0;\n" +
- " }\n" +
- "}\n",
- },
- "----------\n" +
- "1. ERROR in test\\Outer.java (at line 2)\n" +
- " import static test.Outer.Inner.VALUE;\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^\n" +
- "The field Outer.Inner.test.Outer.Inner.VALUE is not visible\n" +
- "----------\n" +
- "2. ERROR in test\\Outer.java (at line 4)\n" +
- " int i = VALUE;\n" +
- " ^^^^^\n" +
- "VALUE cannot be resolved to a variable\n" +
+ "package test;\n" +
+ "import static test.Outer.Inner.VALUE;\n" +
+ "public class Outer {\n" +
+ " int i = VALUE;\n" +
+ " int i2 = Inner.VALUE;\n" +
+ " static class Inner {\n" +
+ " private static final int VALUE = 0;\n" +
+ " }\n" +
+ "}\n",
+ },
+ "----------\n" +
+ "1. ERROR in test\\Outer.java (at line 2)\n" +
+ " import static test.Outer.Inner.VALUE;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The field Outer.Inner.test.Outer.Inner.VALUE is not visible\n" +
+ "----------\n" +
+ "2. ERROR in test\\Outer.java (at line 4)\n" +
+ " int i = VALUE;\n" +
+ " ^^^^^\n" +
+ "VALUE cannot be resolved to a variable\n" +
"----------\n");
- }
+ }
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=256375 - variation
public void test074() {
this.runConformTest(
new String[] {
"test/Outer.java",
- "package test;\n" +
- "import static test.Outer.Inner.*;\n" +
- "public class Outer {\n" +
- " int i = VALUE;\n" +
- " int i2 = Inner.VALUE;\n" +
- " static class Inner {\n" +
- " private static final int VALUE = 0;\n" +
- " }\n" +
+ "package test;\n" +
+ "import static test.Outer.Inner.*;\n" +
+ "public class Outer {\n" +
+ " int i = VALUE;\n" +
+ " int i2 = Inner.VALUE;\n" +
+ " static class Inner {\n" +
+ " private static final int VALUE = 0;\n" +
+ " }\n" +
"}\n",
},
"");
- }
+ }
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865
// To verify that a static import importing a type which has already been
// imported by a single type import is reported as duplicate
@@ -2613,28 +2613,28 @@ public void test077() {
this.runConformTest(
new String[] {
"p1/X.java",
- "package p1;\n" +
- "import p2.A;\n" +
- "import static p2.A.C;\n" +
- "import static p1.B.C;\n" +
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " foo();\n" +
- " }\n" +
- " public static void foo() {\n" +
- " if (C.CONST == 1) {\n" +
+ "package p1;\n" +
+ "import p2.A;\n" +
+ "import static p2.A.C;\n" +
+ "import static p1.B.C;\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " foo();\n" +
+ " }\n" +
+ " public static void foo() {\n" +
+ " if (C.CONST == 1) {\n" +
" System.out.println(\"SUCCESS\");\n" +
- " return;\n" +
- " }\n" +
- " System.out.println(\"FAILED\");\n" +
- " }\n" +
- "}\n" +
+ " return;\n" +
+ " }\n" +
+ " System.out.println(\"FAILED\");\n" +
+ " }\n" +
+ "}\n" +
"class B extends A {}",
"p2/A.java",
- "package p2;\n" +
- "public class A {\n" +
- " public static class C {\n" +
- " public static int CONST = 1;\n" +
+ "package p2;\n" +
+ "public class A {\n" +
+ " public static class C {\n" +
+ " public static int CONST = 1;\n" +
" }\n" +
"}"
},
@@ -2666,11 +2666,11 @@ public void test078() {
" }\n" +
"}\n",
},
- "----------\n" +
- "1. ERROR in A\\A.java (at line 3)\n" +
- " import B.B.C1;\n" +
- " ^^^^^^\n" +
- "The import B.B.C1 collides with another import statement\n" +
+ "----------\n" +
+ "1. ERROR in A\\A.java (at line 3)\n" +
+ " import B.B.C1;\n" +
+ " ^^^^^^\n" +
+ "The import B.B.C1 collides with another import statement\n" +
"----------\n"
);
}
@@ -2695,11 +2695,11 @@ public void test079() {
" public static class C1 {}\n" +
"}\n",
},
- "----------\n" +
- "1. WARNING in A\\A.java (at line 2)\n" +
- " import static B.B.C1;\n" +
- " ^^^^^^\n" +
- "The import B.B.C1 is never used\n" +
+ "----------\n" +
+ "1. WARNING in A\\A.java (at line 2)\n" +
+ " import static B.B.C1;\n" +
+ " ^^^^^^\n" +
+ "The import B.B.C1 is never used\n" +
"----------\n"
);
}
@@ -2708,31 +2708,31 @@ public void test080() {
this.runNegativeTest(
new String[] {
"a/B.java",
- "package a;\n" +
+ "package a;\n" +
"public class B {}",
"external/Lib.java",
- "package external;\n" +
- "public class Lib {\n" +
- " public static void m() {}\n" +
+ "package external;\n" +
+ "public class Lib {\n" +
+ " public static void m() {}\n" +
"}",
"a/B/C.java",
- "package a.B;\n" +
- "import static external.Lib.m;\n" +
- "public class C {\n" +
- " public void main() {\n" +
- " m();\n" +
- " }\n" +
+ "package a.B;\n" +
+ "import static external.Lib.m;\n" +
+ "public class C {\n" +
+ " public void main() {\n" +
+ " m();\n" +
+ " }\n" +
"}"
},
- "----------\n" +
- "1. ERROR in a\\B\\C.java (at line 1)\n" +
- " package a.B;\n" +
- " ^^^\n" +
- "The package a.B collides with a type\n" +
+ "----------\n" +
+ "1. ERROR in a\\B\\C.java (at line 1)\n" +
+ " package a.B;\n" +
+ " ^^^\n" +
+ "The package a.B collides with a type\n" +
"----------\n"
);
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
public void test081() {
this.runConformTest(
@@ -2773,7 +2773,7 @@ public void test081() {
},
"1 + 1 = 2");
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
public void test082() {
this.runNegativeTest(
@@ -2814,13 +2814,13 @@ public void test082() {
"}\n",
},
"----------\n" +
- "1. ERROR in p2\\Test.java (at line 15)\n" +
- " int abc = b.a;\n" +
- " ^\n" +
- "a cannot be resolved or is not a field\n" +
+ "1. ERROR in p2\\Test.java (at line 15)\n" +
+ " int abc = b.a;\n" +
+ " ^\n" +
+ "a cannot be resolved or is not a field\n" +
"----------\n");
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
public void test083() {
this.runConformTest(
@@ -2854,12 +2854,12 @@ public void test083() {
" }\n" +
"}\n"
},
- "random\n" +
- "random\n" +
- "p1.Bar.B\n" +
+ "random\n" +
+ "random\n" +
+ "p1.Bar.B\n" +
"p1.Bar.B");
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=318401
// Check if we're able to find the correct static member type being imported,
// even though the import originally resolved to the static field of the same name,
@@ -2898,7 +2898,7 @@ public void test084() {
" }\n" +
"}\n"
},
- "p1.Bar.B\n" +
+ "p1.Bar.B\n" +
"p1.Bar.B");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
@@ -2931,20 +2931,20 @@ public void test085() {
" }\n" +
"}\n"
},
- this.complianceLevel < ClassFileConstants.JDK1_8 ?
- "----------\n" +
- "1. ERROR in Test.java (at line 2)\n" +
- " import static p3.Foo.B;\n" +
- " ^^^^^^^^\n" +
- "The import p3.Foo.B collides with another import statement\n" +
- "----------\n" :
- "----------\n" +
- "1. ERROR in Test.java (at line 7)\n" +
- " System.out.println(B.class.getCanonicalName().toString());\n" +
- " ^\n" +
- "The type B is ambiguous\n" +
+ this.complianceLevel < ClassFileConstants.JDK1_8 ?
+ "----------\n" +
+ "1. ERROR in Test.java (at line 2)\n" +
+ " import static p3.Foo.B;\n" +
+ " ^^^^^^^^\n" +
+ "The import p3.Foo.B collides with another import statement\n" +
+ "----------\n" :
+ "----------\n" +
+ "1. ERROR in Test.java (at line 7)\n" +
+ " System.out.println(B.class.getCanonicalName().toString());\n" +
+ " ^\n" +
+ "The type B is ambiguous\n" +
"----------\n"
-
+
);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
@@ -2983,14 +2983,14 @@ public void test085a() {
" }\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in Test.java (at line 2)\n" +
- " import static p3.Foo.B;\n" +
- " ^^^^^^^^\n" +
- "The import p3.Foo.B collides with another import statement\n" +
+ "----------\n" +
+ "1. ERROR in Test.java (at line 2)\n" +
+ " import static p3.Foo.B;\n" +
+ " ^^^^^^^^\n" +
+ "The import p3.Foo.B collides with another import statement\n" +
"----------\n");
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
// To verify that all static members are imported with a single static import statement
// this tests checks collision with single type import
@@ -3022,14 +3022,14 @@ public void test085b() {
" }\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in Test.java (at line 2)\n" +
- " import p3.Foo.B;\n" +
- " ^^^^^^^^\n" +
- "The import p3.Foo.B collides with another import statement\n" +
+ "----------\n" +
+ "1. ERROR in Test.java (at line 2)\n" +
+ " import p3.Foo.B;\n" +
+ " ^^^^^^^^\n" +
+ "The import p3.Foo.B collides with another import statement\n" +
"----------\n");
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
// To verify that all static members are imported with a single static import statement
// this tests checks collision with top level type
@@ -3056,14 +3056,14 @@ public void test085c() {
" public static String B = new String(\"random\");\n" +
"}\n",
},
- "----------\n" +
- "1. ERROR in Test.java (at line 1)\n" +
- " import static p1.Bar.B;\n" +
- " ^^^^^^^^\n" +
- "The import p1.Bar.B conflicts with a type defined in the same file\n" +
+ "----------\n" +
+ "1. ERROR in Test.java (at line 1)\n" +
+ " import static p1.Bar.B;\n" +
+ " ^^^^^^^^\n" +
+ "The import p1.Bar.B conflicts with a type defined in the same file\n" +
"----------\n");
}
-
+
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=361327
// Test obscuring rules defined in JLS 7.5.3
public void test086() {
@@ -3094,7 +3094,7 @@ public void test086() {
" public static String B = new String(\"Foo's field B\");\n" +
"}\n"
},
- "Bar\'s method B\n" +
+ "Bar\'s method B\n" +
"Bar\'s field B");
}
@@ -3107,24 +3107,24 @@ public void testBug401271() {
"public class a {}\n",
"a/b/c/C.java",
"package a.b.c;\n" +
- "public class C {\n" +
- " public static final int a = 3;\n" +
+ "public class C {\n" +
+ " public static final int a = 3;\n" +
"}\n",
"x/y/R.java",
- "package x.y;\n" +
- "import static a.b.c.C.a;\n" +
- "//import a.b.c.a;\n" +
- "\n" +
- "public class R { \n" +
- " a b; \n" +
- " char h = a; \n" +
+ "package x.y;\n" +
+ "import static a.b.c.C.a;\n" +
+ "//import a.b.c.a;\n" +
+ "\n" +
+ "public class R { \n" +
+ " a b; \n" +
+ " char h = a; \n" +
"}"
},
- "----------\n" +
- "1. ERROR in x\\y\\R.java (at line 6)\n" +
- " a b; \n" +
- " ^\n" +
- "a cannot be resolved to a type\n" +
+ "----------\n" +
+ "1. ERROR in x\\y\\R.java (at line 6)\n" +
+ " a b; \n" +
+ " ^\n" +
+ "a cannot be resolved to a type\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=426544 - [1.8][compiler] Compiler over-eagerly detects collision of single static imports
@@ -3146,50 +3146,50 @@ public void test426544() {
" public static class I {}\n" +
"}\n",
"X.java",
- "import static p.X.f;\n" +
- "import static q.X.f;\n" +
- "import static p.X.C;\n" +
- "import static p.X.I;\n" +
- "import static q.X.C;\n" +
- "import static q.X.I;\n" +
- "public class X { \n" +
+ "import static p.X.f;\n" +
+ "import static q.X.f;\n" +
+ "import static p.X.C;\n" +
+ "import static p.X.I;\n" +
+ "import static q.X.C;\n" +
+ "import static q.X.I;\n" +
+ "public class X { \n" +
" { f = 0; }\n" +
" { C c = null; }\n" +
" { I i = null; }\n" +
"}\n"
},
- this.complianceLevel < ClassFileConstants.JDK1_8 ?
- "----------\n" +
- "1. ERROR in X.java (at line 2)\n" +
- " import static q.X.f;\n" +
- " ^^^^^\n" +
- "The import q.X.f collides with another import statement\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 5)\n" +
- " import static q.X.C;\n" +
- " ^^^^^\n" +
- "The import q.X.C collides with another import statement\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 6)\n" +
- " import static q.X.I;\n" +
- " ^^^^^\n" +
- "The import q.X.I collides with another import statement\n" +
+ this.complianceLevel < ClassFileConstants.JDK1_8 ?
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " import static q.X.f;\n" +
+ " ^^^^^\n" +
+ "The import q.X.f collides with another import statement\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " import static q.X.C;\n" +
+ " ^^^^^\n" +
+ "The import q.X.C collides with another import statement\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " import static q.X.I;\n" +
+ " ^^^^^\n" +
+ "The import q.X.I collides with another import statement\n" +
"----------\n" :
- "----------\n" +
- "1. ERROR in X.java (at line 8)\n" +
- " { f = 0; }\n" +
- " ^\n" +
- "The field f is ambiguous\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 9)\n" +
- " { C c = null; }\n" +
- " ^\n" +
- "The type C is ambiguous\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 10)\n" +
- " { I i = null; }\n" +
- " ^\n" +
- "The type I is ambiguous\n" +
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " { f = 0; }\n" +
+ " ^\n" +
+ "The field f is ambiguous\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " { C c = null; }\n" +
+ " ^\n" +
+ "The type C is ambiguous\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 10)\n" +
+ " { I i = null; }\n" +
+ " ^\n" +
+ "The type I is ambiguous\n" +
"----------\n");
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=479287
@@ -3198,30 +3198,30 @@ public void testBug479287() {
this.runConformTest(
new String[] {
"joetest/GenericsIssue.java",
- "package joetest;\n" +
- "import static joetest.GenericsIssueCollaborator.takesAnything;\n" +
- "import java.util.Collection;\n" +
- "import java.util.Collections;\n" +
- "public class GenericsIssue {\n" +
- " private void oddCompileError() {\n" +
- " takesAnything(returnThings(\"works without wildcard in return value\"));\n" +
- " GenericsIssueCollaborator.takesAnything(returnThingsWildcard(\"works without static import\"));\n" +
- " takesAnything(returnThingsWildcard(\"doesn\'t work with static import\"));\n" +
- " }\n" +
- " private Collection returnThings(T thing) {\n" +
- " return Collections.singleton(thing);\n" +
- " }\n" +
- " \n" +
- " private Collection extends T> returnThingsWildcard(T toReturn) {\n" +
- " return Collections.singleton(toReturn);\n" +
- " }\n" +
+ "package joetest;\n" +
+ "import static joetest.GenericsIssueCollaborator.takesAnything;\n" +
+ "import java.util.Collection;\n" +
+ "import java.util.Collections;\n" +
+ "public class GenericsIssue {\n" +
+ " private void oddCompileError() {\n" +
+ " takesAnything(returnThings(\"works without wildcard in return value\"));\n" +
+ " GenericsIssueCollaborator.takesAnything(returnThingsWildcard(\"works without static import\"));\n" +
+ " takesAnything(returnThingsWildcard(\"doesn\'t work with static import\"));\n" +
+ " }\n" +
+ " private Collection returnThings(T thing) {\n" +
+ " return Collections.singleton(thing);\n" +
+ " }\n" +
+ " \n" +
+ " private Collection extends T> returnThingsWildcard(T toReturn) {\n" +
+ " return Collections.singleton(toReturn);\n" +
+ " }\n" +
"}",
"joetest/GenericsIssueCollaborator.java",
- "package joetest;\n" +
- "public class GenericsIssueCollaborator {\n" +
- " public static void takesAnything(T thing) {\n" +
- " System.out.println(\"TOOK IT: \" + thing);\n" +
- " }\n" +
+ "package joetest;\n" +
+ "public class GenericsIssueCollaborator {\n" +
+ " public static void takesAnything(T thing) {\n" +
+ " System.out.println(\"TOOK IT: \" + thing);\n" +
+ " }\n" +
"}"
});
}
@@ -3230,30 +3230,30 @@ public void testBug479287() {
public void testBug442580() {
this.runConformTest(new String [] {
"a/A.java",
- "package a;\n" +
- "\n" +
- "public class A {\n" +
- " public static void foo() {\n" +
- " System.out.println(\"A.foo\");\n" +
- " }\n" +
+ "package a;\n" +
+ "\n" +
+ "public class A {\n" +
+ " public static void foo() {\n" +
+ " System.out.println(\"A.foo\");\n" +
+ " }\n" +
"}",
"b/B.java",
- "package b;\n" +
- "\n" +
- "public class B {\n" +
- " public static void foo() {\n" +
- " System.out.println(\"B.foo\");\n" +
- " }\n" +
+ "package b;\n" +
+ "\n" +
+ "public class B {\n" +
+ " public static void foo() {\n" +
+ " System.out.println(\"B.foo\");\n" +
+ " }\n" +
"}",
"Test.java",
- "import static a.A.*;\n" +
- "import static b.B.*;\n" +
- "import static b.B.foo;\n" +
- "\n" +
- "public class Test {\n" +
- " public static void main(String[] args) {\n" +
- " foo();\n" +
- " }\n" +
+ "import static a.A.*;\n" +
+ "import static b.B.*;\n" +
+ "import static b.B.foo;\n" +
+ "\n" +
+ "public class Test {\n" +
+ " public static void main(String[] args) {\n" +
+ " foo();\n" +
+ " }\n" +
"}"
});
}
@@ -3272,21 +3272,21 @@ public void testBug520874a() {
" static class Outer {\n" +
" private static interface Inner {}\n" +
" }\n" +
- " static class AnotherOuter {\n" +
- " private static class Inner {}\n" +
- " }\n" +
+ " static class AnotherOuter {\n" +
+ " private static class Inner {}\n" +
+ " }\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in p\\X.java (at line 3)\n" +
- " import static p.A1.AnotherOuter.Inner;\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "The type p.A1.AnotherOuter.Inner is not visible\n" +
- "----------\n" +
- "2. ERROR in p\\X.java (at line 6)\n" +
- " static class Outer {\n" +
- " ^^^^^\n" +
- "The type Inner is not visible\n" +
+ "----------\n" +
+ "1. ERROR in p\\X.java (at line 3)\n" +
+ " import static p.A1.AnotherOuter.Inner;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The type p.A1.AnotherOuter.Inner is not visible\n" +
+ "----------\n" +
+ "2. ERROR in p\\X.java (at line 6)\n" +
+ " static class Outer {\n" +
+ " ^^^^^\n" +
+ "The type Inner is not visible\n" +
"----------\n");
}
public void testBug520874b() {
@@ -3305,11 +3305,11 @@ public void testBug520874b() {
" }\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in p\\X.java (at line 5)\n" +
- " static class Outer {\n" +
- " ^^^^^\n" +
- "The type Inner is not visible\n" +
+ "----------\n" +
+ "1. ERROR in p\\X.java (at line 5)\n" +
+ " static class Outer {\n" +
+ " ^^^^^\n" +
+ "The type Inner is not visible\n" +
"----------\n");
}
public void testBug520874c() {
@@ -3327,31 +3327,31 @@ public void testBug520874c() {
" static class Outer {\n" +
" private static interface Inner {}\n" +
" }\n" +
- " static class AnotherOuter {\n" +
- " private static class Inner {}\n" +
- " }\n" +
+ " static class AnotherOuter {\n" +
+ " private static class Inner {}\n" +
+ " }\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in p\\X.java (at line 2)\n" +
- " import static p.A1.Outer.Inner;\n" +
- " ^^^^^^^^^^^^^^^^\n" +
- "The type p.A1.Outer.Inner is not visible\n" +
- "----------\n" +
- "2. ERROR in p\\X.java (at line 3)\n" +
- " import static p.A1.AnotherOuter.Inner;\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "The type p.A1.AnotherOuter.Inner is not visible\n" +
- "----------\n" +
- "3. ERROR in p\\X.java (at line 6)\n" +
- " static class Outer {\n" +
- " ^^^^^\n" +
- "Inner cannot be resolved to a type\n" +
- "----------\n" +
- "4. ERROR in p\\X.java (at line 9)\n" +
- " static class AnotherOuter {\n" +
- " ^^^^^\n" +
- "Inner cannot be resolved to a type\n" +
+ "----------\n" +
+ "1. ERROR in p\\X.java (at line 2)\n" +
+ " import static p.A1.Outer.Inner;\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The type p.A1.Outer.Inner is not visible\n" +
+ "----------\n" +
+ "2. ERROR in p\\X.java (at line 3)\n" +
+ " import static p.A1.AnotherOuter.Inner;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The type p.A1.AnotherOuter.Inner is not visible\n" +
+ "----------\n" +
+ "3. ERROR in p\\X.java (at line 6)\n" +
+ " static class Outer {\n" +
+ " ^^^^^\n" +
+ "Inner cannot be resolved to a type\n" +
+ "----------\n" +
+ "4. ERROR in p\\X.java (at line 9)\n" +
+ " static class AnotherOuter {\n" +
+ " ^^^^^\n" +
+ "Inner cannot be resolved to a type\n" +
"----------\n");
}
public void testBug520874d() {
@@ -3374,16 +3374,16 @@ public void testBug520874d() {
" public static class Inner {}\n" +
"}\n"
},
- "----------\n" +
- "1. WARNING in p\\X.java (at line 2)\n" +
- " import static p.A.B.Inner;\n" +
- " ^^^^^^^^^^^\n" +
- "The import p.A.B.Inner is never used\n" +
- "----------\n" +
- "2. WARNING in p\\X.java (at line 3)\n" +
- " import p.Bar.Inner;\n" +
- " ^^^^^^^^^^^\n" +
- "The import p.Bar.Inner is never used\n" +
+ "----------\n" +
+ "1. WARNING in p\\X.java (at line 2)\n" +
+ " import static p.A.B.Inner;\n" +
+ " ^^^^^^^^^^^\n" +
+ "The import p.A.B.Inner is never used\n" +
+ "----------\n" +
+ "2. WARNING in p\\X.java (at line 3)\n" +
+ " import p.Bar.Inner;\n" +
+ " ^^^^^^^^^^^\n" +
+ "The import p.Bar.Inner is never used\n" +
"----------\n");
}
public void testBug520874e() {
@@ -3406,16 +3406,190 @@ public void testBug520874e() {
" public static class Inner {}\n" +
"}\n"
},
- "----------\n" +
- "1. WARNING in p\\X.java (at line 2)\n" +
- " import static p.A.B.Inner;\n" +
- " ^^^^^^^^^^^\n" +
- "The import p.A.B.Inner is never used\n" +
- "----------\n" +
- "2. WARNING in p\\X.java (at line 3)\n" +
- " import p.Bar.*;\n" +
- " ^^^^^\n" +
- "The import p.Bar is never used\n" +
+ "----------\n" +
+ "1. WARNING in p\\X.java (at line 2)\n" +
+ " import static p.A.B.Inner;\n" +
+ " ^^^^^^^^^^^\n" +
+ "The import p.A.B.Inner is never used\n" +
+ "----------\n" +
+ "2. WARNING in p\\X.java (at line 3)\n" +
+ " import p.Bar.*;\n" +
+ " ^^^^^\n" +
+ "The import p.Bar is never used\n" +
"----------\n");
}
-}
\ No newline at end of file
+ public void testGH809_field_a() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "p2/Client.java",
+ """
+ package p2;
+ import static p1.Sub.*;
+ public class Client {
+ public static void main(String... args) {
+ System.out.println(ONE);
+ }
+ }
+ """,
+ "p1/Super.java",
+ """
+ package p1;
+ class Super {
+ public static int ONE = 1;
+ }
+ """,
+ "p1/Sub.java",
+ """
+ package p1;
+ public class Sub extends Super {}
+ """
+ };
+ runner.expectedOutputString = "1";
+ runner.runConformTest();
+ }
+ public void testGH809_field_b() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "p2/Client.java",
+ """
+ package p2;
+ import static p1.Sub.ONE;
+ public class Client {
+ public static void main(String... args) {
+ System.out.println(ONE);
+ }
+ }
+ """,
+ "p1/Super.java",
+ """
+ package p1;
+ class Super {
+ public static int ONE = 1;
+ }
+ """,
+ "p1/Sub.java",
+ """
+ package p1;
+ public class Sub extends Super {}
+ """
+ };
+ runner.expectedOutputString = "1";
+ runner.runConformTest();
+ }
+ public void testGH809_field_c() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "p2/Client.java",
+ """
+ package p2;
+ import p1.Sub;
+ public class Client {
+ public static void main(String... args) {
+ System.out.println(Sub.ONE);
+ }
+ }
+ """,
+ "p1/Super.java",
+ """
+ package p1;
+ class Super {
+ public static int ONE = 1;
+ }
+ """,
+ "p1/Sub.java",
+ """
+ package p1;
+ public class Sub extends Super {}
+ """
+ };
+ runner.expectedOutputString = "1";
+ runner.runConformTest();
+ }
+ public void testGH809_method_a() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "p2/Client.java",
+ """
+ package p2;
+ import static p1.Sub.*;
+ public class Client {
+ public static void main(String... args) {
+ System.out.println(ONE());
+ }
+ }
+ """,
+ "p1/Super.java",
+ """
+ package p1;
+ class Super {
+ public static int ONE() { return 1; }
+ }
+ """,
+ "p1/Sub.java",
+ """
+ package p1;
+ public class Sub extends Super {}
+ """
+ };
+ runner.expectedOutputString = "1";
+ runner.runConformTest();
+ }
+ public void testGH809_method_b() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "p2/Client.java",
+ """
+ package p2;
+ import static p1.Sub.ONE;
+ public class Client {
+ public static void main(String... args) {
+ System.out.println(ONE());
+ }
+ }
+ """,
+ "p1/Super.java",
+ """
+ package p1;
+ class Super {
+ public static int ONE() { return 1; }
+ }
+ """,
+ "p1/Sub.java",
+ """
+ package p1;
+ public class Sub extends Super {}
+ """
+ };
+ runner.expectedOutputString = "1";
+ runner.runConformTest();
+ }
+ public void testGH809_method_c() {
+ Runner runner = new Runner();
+ runner.testFiles = new String[] {
+ "p2/Client.java",
+ """
+ package p2;
+ import p1.Sub;
+ public class Client {
+ public static void main(String... args) {
+ System.out.println(Sub.ONE());
+ }
+ }
+ """,
+ "p1/Super.java",
+ """
+ package p1;
+ class Super {
+ public static int ONE() { return 1; }
+ }
+ """,
+ "p1/Sub.java",
+ """
+ package p1;
+ public class Sub extends Super {}
+ """
+ };
+ runner.expectedOutputString = "1";
+ runner.runConformTest();
+ }
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
index 84763f0185..315455f66b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
@@ -694,7 +694,6 @@ public void testBug544073_020() {
expectedProblemLog);
}
/*
- *
*/
public void testBug544073_021() {
String[] testFiles = new String[] {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java
index f168ec7f71..6dbae7389a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java
@@ -30,7 +30,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
static {
// TESTS_NUMBERS = new int [] { 40 };
// TESTS_RANGE = new int[] { 1, -1 };
-// TESTS_NAMES = new String[] { "testIssueExhaustiveness_005"};
+// TESTS_NAMES = new String[] { "testIssue1466_02"};
}
private static String previewLevel = "21";
@@ -2886,12 +2886,20 @@ public void testBug575249_03() {
" }\n"+
"}",
},
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " case (String s) -> 0;\n" +
- " ^\n" +
- "Syntax error, insert \":\" to complete SwitchLabel\n" +
- "----------\n");
+ """
+ ----------
+ 1. ERROR in X.java (at line 4)
+ case (String s) -> 0;
+ ^^^^
+ Syntax error on token "case", ( expected after this token
+ ----------
+ 2. ERROR in X.java (at line 4)
+ case (String s) -> 0;
+ ^
+ Syntax error, insert ":" to complete SwitchLabel
+ ----------
+ """
+ );
}
public void testBug575249_04() {
runConformTest(
@@ -4490,22 +4498,29 @@ public void testBug578553_1() {
+ " }\n"
+ "}",
},
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^^^^\n" +
- "Syntax error on token(s), misplaced construct(s)\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^^^^\n" +
- "Syntax error on token \"RestrictedIdentifierWhen\", delete this token\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^\n" +
- "Syntax error on token \")\", -> expected after this token\n" +
- "----------\n");
+ """
+ ----------
+ 1. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^
+ Syntax error on token "l", delete this token
+ ----------
+ 2. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^^^
+ Syntax error, insert ":: IdentifierOrNew" to complete ReferenceExpression
+ ----------
+ 3. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^^^
+ Syntax error, insert ":" to complete SwitchLabel
+ ----------
+ 4. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^
+ Syntax error on token "->", ; expected
+ ----------
+ """);
}
public void testBug578553_2() {
runNegativeTest(
@@ -4530,22 +4545,34 @@ public void testBug578553_2() {
+ " }\n"
+ "}",
},
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^^^^\n" +
- "Syntax error on token(s), misplaced construct(s)\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^^^^\n" +
- "Syntax error on token \"RestrictedIdentifierWhen\", delete this token\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^\n" +
- "Syntax error on token \")\", -> expected after this token\n" +
- "----------\n");
+ """
+ ----------
+ 1. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^
+ Syntax error on token "l", delete this token
+ ----------
+ 2. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^^^
+ Syntax error, insert ":: IdentifierOrNew" to complete ReferenceExpression
+ ----------
+ 3. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^^^
+ Syntax error, insert ":" to complete SwitchLabel
+ ----------
+ 4. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^
+ Syntax error on token "->", ; expected
+ ----------
+ 5. ERROR in X.java (at line 6)
+ case Long l1 when l1.toString().equals(l1.toString()) -> {
+ ^^^^
+ Syntax error on token "when", , expected
+ ----------
+ """);
}
public void testBug578553_3() {
runNegativeTest(
@@ -4567,22 +4594,34 @@ public void testBug578553_3() {
+ " }\n"
+ "}",
},
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^^^^\n" +
- "Syntax error on token(s), misplaced construct(s)\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^^^^\n" +
- "Syntax error on token \"RestrictedIdentifierWhen\", delete this token\n" +
- "----------\n" +
- "3. ERROR in X.java (at line 4)\n" +
- " case (Long l) when l.toString().equals(\"0\") -> {\n" +
- " ^\n" +
- "Syntax error on token \")\", -> expected after this token\n" +
- "----------\n");
+ """
+ ----------
+ 1. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^
+ Syntax error on token "l", delete this token
+ ----------
+ 2. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^^^
+ Syntax error, insert ":: IdentifierOrNew" to complete ReferenceExpression
+ ----------
+ 3. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^^^
+ Syntax error, insert ":" to complete SwitchLabel
+ ----------
+ 4. ERROR in X.java (at line 4)
+ case (Long l) when l.toString().equals("0") -> {
+ ^^
+ Syntax error on token "->", ; expected
+ ----------
+ 5. ERROR in X.java (at line 6)
+ case Long l1 when l.toString().equals(l1.toString()) -> {
+ ^^^^
+ Syntax error on token "when", , expected
+ ----------
+ """);
}
public void testBug578553_4() {
runNegativeTest(
@@ -6779,4 +6818,152 @@ public void testIssue1351_11() {
"Cannot mix pattern with other case labels\n" +
"----------\n");
}
+
+ public void testDisambiguatedRestrictedIdentifierWhenAsFirstMethodInvokation() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"
+ + " public static void main(String argv[]) {\n"
+ + " when(\"Pass\");\n"
+ + " }\n"
+ + " static void when(String arg) {\n"
+ + " System.out.println(arg);\n"
+ + " }\n"
+ + "}"
+ },
+ "Pass");
+ }
+
+ public void testDisambiguatedRestrictedIdentifierWhenAsFirstVariableDeclaration() {
+ runConformTest(
+ new String[] {
+ "when.java",
+ "public class when {\n"
+ + " public static void main(String argv[]) {\n"
+ + " when x = new when();\n"
+ + " System.out.println(x);\n"
+ + " }\n"
+ + " public String toString() {\n"
+ + " return \"Pass\";\n"
+ + " }\n"
+ + "}"
+ },
+ "Pass");
+ }
+
+ public void testDisambiguatedRestrictedIdentifierWhenAsTypeInACase() {
+ runConformTest(
+ new String[] {
+ "when.java",
+ "public class when {\n"
+ + " public String toString() {\n"
+ + " return switch((Object) this) {\n"
+ + " case when x -> \"Pass\";\n"
+ + " default -> \"Fail\";\n"
+ + " };\n"
+ + " }\n"
+ + " public static void main(String argv[]) {\n"
+ + " System.out.println(new when());\n"
+ + " }\n"
+ + "}"
+ },
+ "Pass");
+ }
+
+ public void testDisambiguatedRestrictedIdentifierWhenAfterAParenthesis() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"
+ + " public static void main(String argv[]) {\n"
+ + " System.out.println( (Boolean) when(true) );\n"
+ + " }\n"
+ + " static Object when(Object arg) {\n"
+ + " return arg;\n"
+ + " }\n"
+ + "}"
+ },
+ "true");
+ }
+
+ public void testValidCodeWithVeryAmbiguousUsageOfWhen() {
+ runConformTest(
+ new String[] {
+ "when.java",
+ "class when {\n"
+ + " boolean when = true;\n"
+ + " static boolean when(when arg) {\n"
+ + " return switch(arg) {\n"
+ + " case when when when when.when && when.when(null) -> when.when;\n"
+ + " case null -> true;\n"
+ + " default -> false;\n"
+ + " };\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " System.out.println(when(new when()));\n"
+ + " }\n"
+ + "}"
+ },
+ "true");
+ }
+ public void testIssue1466_01() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ """
+ public class X {
+
+ private static String foo(Integer i) {
+ return switch (i) {
+ case null -> "null";
+ case Integer value when value > 0 -> value.toString();
+ default -> i.toString();
+ };
+ }
+
+ public static void main(String[] args) {
+ System.out.println(foo(0));
+ }
+ }
+
+ """,
+ },
+ "0");
+ }
+ public void testIssue1466_02() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ """
+ public class X {
+ public static void main(String[] args) {
+ constantLabelMustAppearBeforePatternInteger(-1);
+ constantLabelMustAppearBeforePatternInteger(0);
+ constantLabelMustAppearBeforePatternInteger(42);
+ constantLabelMustAppearBeforePatternInteger(-99);
+ constantLabelMustAppearBeforePatternInteger(Integer.valueOf(123));
+ constantLabelMustAppearBeforePatternInteger(null);
+ }
+ static String constantLabelMustAppearBeforePatternInteger(Integer i) {
+ switch (i) {
+ case null -> System.out.println("value unavailable: " + i);
+ case -1, 1 -> System.out.println("absolute value 1: " + i);
+ case Integer value when value > 0 -> System.out.println("positive integer: " + i);
+ default -> System.out.println("other integer: " + i);
+ }
+ return i == null ? "null" : i.toString();
+ }
+ }
+
+ """,
+ },
+ "absolute value 1: -1\n" +
+ "other integer: 0\n" +
+ "positive integer: 42\n" +
+ "other integer: -99\n" +
+ "positive integer: 123\n" +
+ "value unavailable: null"
+);
+ }
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
index b971f434db..72d147bc6f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
@@ -234,6 +234,7 @@ public static Test suite() {
ArrayList since_21 = new ArrayList();
since_21.add(SwitchPatternTest.class);
since_21.add(RecordPatternTest.class);
+// since_21.add(UnnammedPatternsAndVarsTest.class); Enable after implementation.
since_21.add(NullAnnotationTests18.class);
// Build final test suite
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
index 0c9d879e59..baac48baea 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java
@@ -27,7 +27,6 @@
* strategy is to keep this one updated and when the time comes, move this over
* to the other bundle after synch-up of tests from both.
* @author jay
- *
*/
public class TextBlockTest extends AbstractRegressionTest {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java
index 36982eee3c..6ac0148c4d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java
@@ -4396,6 +4396,26 @@ public void testGHIssue1063() {
" at X.main(X.java:7)\n",
null);
}
+
+// https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1495
+public void testGHissue1495() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.io.*;\n" +
+ "interface I extends Closeable {}\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " try (I i = i()) {\n" +
+ " return;\n" +
+ " } finally {\n" +
+ " return;\n" +
+ " }" +
+ " }" +
+ " public static I i() { return null; }\n" +
+ "}\n"
+ });
+}
public static Class testClass() {
return TryWithResourcesStatementTest.class;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnammedPatternsAndVarsTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnammedPatternsAndVarsTest.java
new file mode 100644
index 0000000000..47d10629c6
--- /dev/null
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnammedPatternsAndVarsTest.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2023 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.util.Map;
+
+import org.eclipse.jdt.internal.compiler.batch.FileSystem;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+import junit.framework.Test;
+
+public class UnnammedPatternsAndVarsTest extends AbstractRegressionTest9 {
+
+ private static final JavacTestOptions JAVAC_OPTIONS = new JavacTestOptions("-source 21 --enable-preview -Xlint:-preview");
+ static {
+// TESTS_NUMBERS = new int [] { 1 };
+// TESTS_RANGE = new int[] { 1, -1 };
+// TESTS_NAMES = new String[] { "test005" };
+ }
+ private String extraLibPath;
+ public static Class> testClass() {
+ return UnnammedPatternsAndVarsTest.class;
+ }
+ public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_21);
+ }
+ public UnnammedPatternsAndVarsTest(String testName){
+ super(testName);
+ }
+ // Enables the tests to run individually
+ protected Map getCompilerOptions(boolean preview) {
+ Map defaultOptions = super.getCompilerOptions();
+ if (preview) {
+ if (this.complianceLevel >= ClassFileConstants.getLatestJDKLevel()) {
+ defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
+ } else {
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_21);
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_21);
+ defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_21);
+ }
+ }
+ return defaultOptions;
+ }
+
+ protected Map getCompilerOptions() {
+ return getCompilerOptions(true);
+ }
+ protected String[] getDefaultClassPaths() {
+ String[] libs = DefaultJavaRuntimeEnvironment.getDefaultClassPaths();
+ if (this.extraLibPath != null) {
+ String[] l = new String[libs.length + 1];
+ System.arraycopy(libs, 0, l, 0, libs.length);
+ l[libs.length] = this.extraLibPath;
+ return l;
+ }
+ return libs;
+ }
+ @Override
+ protected INameEnvironment getNameEnvironment(final String[] testFiles, String[] classPaths, Map options) {
+ this.classpaths = classPaths == null ? getDefaultClassPaths() : classPaths;
+ INameEnvironment[] classLibs = getClassLibs(false, options);
+ for (INameEnvironment nameEnvironment : classLibs) {
+ ((FileSystem) nameEnvironment).scanForModules(createParser());
+ }
+ return new InMemoryNameEnvironment9(testFiles, this.moduleMap, classLibs);
+ }
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput) {
+ runConformTest(testFiles, expectedOutput, getCompilerOptions(true));
+ }
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput, Map customOptions) {
+ if(!isJRE21Plus)
+ return;
+ runConformTest(testFiles, expectedOutput, customOptions, new String[] {"--enable-preview"}, JAVAC_OPTIONS);
+ }
+ protected void runConformTest(
+ String[] testFiles,
+ String expectedOutputString,
+ String[] classLibraries,
+ boolean shouldFlushOutputDirectory,
+ String[] vmArguments) {
+ runTest(
+ // test directory preparation
+ shouldFlushOutputDirectory /* should flush output directory */,
+ testFiles /* test files */,
+ // compiler options
+ classLibraries /* class libraries */,
+ null /* no custom options */,
+ false /* do not perform statements recovery */,
+ null /* no custom requestor */,
+ // compiler results
+ false /* expecting no compiler errors */,
+ null /* do not check compiler log */,
+ // runtime options
+ false /* do not force execution */,
+ vmArguments /* vm arguments */,
+ // runtime results
+ expectedOutputString /* expected output string */,
+ null /* do not check error string */,
+ // javac options
+ JavacTestOptions.DEFAULT /* default javac test options */);
+ }
+ protected void runNegativeTest(
+ String[] testFiles,
+ String expectedCompilerLog,
+ String javacLog,
+ String[] classLibraries,
+ boolean shouldFlushOutputDirectory,
+ Map customOptions) {
+ Runner runner = new Runner();
+ runner.testFiles = testFiles;
+ runner.expectedCompilerLog = expectedCompilerLog;
+ runner.javacTestOptions = JAVAC_OPTIONS;
+ runner.customOptions = customOptions;
+ runner.expectedJavacOutputString = javacLog;
+ runner.runNegativeTest();
+ }
+ public void _test001() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"+
+ " public static int foo() {\n"+
+ " int _ = 1;\n"+
+ " return 0;\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(X.foo());\n"+
+ " }\n"+
+ "}"
+ },
+ "0");
+ }
+ // Test that pattern variables are allowed for the nested patterns (not just the outermost record pattern)
+ public void _test002() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X {\n"+
+ " public static int foo() {\n"+
+ " int _ = bar();\n"+
+ " return 0;\n"+
+ " }\n"+
+ " public static int bar() {\n"+
+ " return 0;\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(X.foo());\n"+
+ " }\n"+
+ "}"
+ },
+ "0");
+ }
+ public void _test003() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X {\n" +
+ " public static int foo() {\n"+
+ " int _;\n"+ // Error should be thrown - uninitialized
+ " return 0;\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(X.foo());\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " int _;\\n" +
+ " ^\n" +
+ "local variable _ should be initialized\n" +
+ "----------\n");
+ }
+ public void _test004() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X {\n" +
+ " public static int foo() {\n"+
+ " int _ = 0;\n"+ // Error should be thrown - uninitialized
+ " return _;\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " System.out.println(X.foo());\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " int _;\\n" +
+ " ^\n" +
+ "_ can only be used in declarations\n" +
+ "----------\n");
+ }
+ public void _test005() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n" +
+ "public class X {\n" +
+ " public int _;\n"+ // Error should be thrown - Field not allowed
+ " public static void main(String[] args) {\n"+
+ " System.out.println(0);\n"+
+ " }\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " int _;\\n" +
+ " ^\n" +
+ "_ can only be used in declarations\n" +
+ "----------\n");
+ }
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/util/JrtUtilTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/util/JrtUtilTest.java
index 5ba67a3e1a..875904285e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/util/JrtUtilTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/util/JrtUtilTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2022 Andrey Loskutov, and others.
+ * Copyright (c) 2022, 2023 Andrey Loskutov, and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -60,14 +60,14 @@ public void testGetReleaseVersion() {
@Test
public void testGetNewJrtFileSystem() throws Exception {
int majorVersionSegment = getMajorVersionSegment(this.jdkRelease);
- Object jrtSystem = JRTUtil.getJrtSystem(this.image);
+ Object jrtSystem = JRTUtil.getJrtSystem(this.image, null);
Object jrtSystem2 = JRTUtil.getJrtSystem(this.image, String.valueOf(majorVersionSegment));
assertSame(jrtSystem, jrtSystem2);
jrtSystem2 = JRTUtil.getJrtSystem(this.image, String.valueOf(majorVersionSegment-2));
assertNotSame(jrtSystem, jrtSystem2);
- Object jrtSystem3 = JRTUtil.getJrtSystem(this.image);
+ Object jrtSystem3 = JRTUtil.getJrtSystem(this.image, null);
assertSame(jrtSystem, jrtSystem3);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
index 16f9c71bbb..0dfa63eb26 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
@@ -399,7 +399,6 @@ public void acceptAST(String sourceFilePath, CompilationUnit ast) {
/**
* @deprecated
- * @throws IOException
*/
public void testBug415066_001() throws IOException {
File rootDir = new File(System.getProperty("java.io.tmpdir"));
@@ -488,7 +487,6 @@ public void acceptAST(String sourceFilePath, CompilationUnit ast) {
/**
* Negative test case
* @deprecated
- * @throws IOException
*/
public void testBug415066_002() throws IOException {
File rootDir = new File(System.getProperty("java.io.tmpdir"));
@@ -1959,4 +1957,4 @@ public void testBug568629() throws JavaModelException {
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java
index 3ef37988bf..fa061d69e9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java
@@ -653,7 +653,6 @@ public static List buildTestsList(Class evaluationTestClass, int inheritedDepth,
*
* Note that this lis maybe reduced using some mechanisms detailed in {@link #buildTestsList(Class)} method.
*
- * @param evaluationTestClass
* @return a {@link Test test suite}
*/
public static Test buildTestSuite(Class evaluationTestClass) {
@@ -667,8 +666,6 @@ public static Test buildTestSuite(Class evaluationTestClass) {
*
* Note that this lis maybe reduced using some mechanisms detailed in {@link #buildTestsList(Class)} method.
*
- * @param evaluationTestClass
- * @param suiteName
* @return a test suite ({@link Test})
*/
public static Test buildTestSuite(Class evaluationTestClass, String suiteName) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java
index 3a2a2188a4..9e824aee6f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java
@@ -34,7 +34,6 @@ public AbstractReader(String name) {
abstract protected void readerLoop();
/**
* Start the thread that reads events.
- *
*/
public void start() {
this.readerThread = new Thread(
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
index 2ebdd8acbe..89a99a4b27 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java
@@ -21,7 +21,7 @@
class J9VirtualMachine extends LocalVirtualMachine {
private Process proxyProcess;
private AbstractReader proxyConsoleReader;
- private String proxyOutputFile;
+ private final String proxyOutputFile;
/**
* Creates a new J9VirtualMachine from the Processes that runs this VM
* and its J9 Proxy and with the given info.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java
index 6f934ec928..1fa412088a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java
@@ -21,7 +21,7 @@
*/
public class NullConsoleReader extends AbstractReader {
- private InputStream input;
+ private final InputStream input;
/*
* Creates a new console reader that will read from the given input stream.
*/
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java
index 7411aca78d..e57f0b26f0 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java
@@ -20,7 +20,7 @@
* redirects it to a file or to the stdout if "con" is the name of the file.
*/
class ProxyConsoleReader extends AbstractReader {
- private InputStream input;
+ private final InputStream input;
private OutputStream output;
/*
* Creates a new proxy console reader that will read from the given input stream
diff --git a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
index c682c68856..26dcd87bf9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java
@@ -1533,8 +1533,6 @@ public static void zipFiles(File[] files, String zipPath) throws IOException {
* Returns the compilation errors / warnings for the given CompilationResult.
*
* @param compilationResult the compilation result
- * @param showCategory
- * @param showWarningToken
* @return String the problem log
*/
public static String getProblemLog(CompilationResult compilationResult, boolean showCategory, boolean showWarningToken) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionElementNotifier.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionElementNotifier.java
index 87636feec3..3461ed9577 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionElementNotifier.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionElementNotifier.java
@@ -42,7 +42,7 @@
public class CompletionElementNotifier extends SourceElementNotifier {
- private ASTNode assistNode;
+ private final ASTNode assistNode;
public CompletionElementNotifier(
CompletionUnitStructureRequestor requestor,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index 5ee2237866..d8c5d47cac 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -22,6 +22,8 @@
*******************************************************************************/
package org.eclipse.jdt.internal.codeassist;
+import static org.eclipse.jdt.internal.core.JavaModelManager.trace;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -865,7 +867,6 @@ public void acceptPotentiallyCompatibleMethods(MethodBinding[] methods) {/* igno
* all elements found matches the expected type, the completion proposals will not contains the calculated expected type
* relevance. This is done to keep the overloaded method suggestions always on top in this mode as a fix for
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=575149
- *
*/
private boolean strictMatchForExtepectedType = false;
@@ -1902,7 +1903,7 @@ private void buildContext(
buildTokenLocationContext(context, scope, astNode, astNodeParent);
if(DEBUG) {
- System.out.println(context.toString());
+ trace(context.toString());
}
this.requestor.acceptContext(context);
}
@@ -2122,12 +2123,8 @@ private boolean complete(
public void complete(ICompilationUnit sourceUnit, int completionPosition, int pos, ITypeRoot root) {
if(DEBUG) {
- System.out.print("COMPLETION IN "); //$NON-NLS-1$
- System.out.print(sourceUnit.getFileName());
- System.out.print(" AT POSITION "); //$NON-NLS-1$
- System.out.println(completionPosition);
- System.out.println("COMPLETION - Source :"); //$NON-NLS-1$
- System.out.println(sourceUnit.getContents());
+ trace("COMPLETION IN " + new String(sourceUnit.getFileName()) + " AT POSITION " + completionPosition); //$NON-NLS-1$//$NON-NLS-2$
+ trace("COMPLETION - Source :" + new String(sourceUnit.getContents())); //$NON-NLS-1$
}
if (this.monitor != null) this.monitor.beginTask(Messages.engine_completing, IProgressMonitor.UNKNOWN);
this.requestor.beginReporting();
@@ -2148,8 +2145,8 @@ public void complete(ICompilationUnit sourceUnit, int completionPosition, int po
// boolean completionNodeFound = false;
if (parsedUnit != null) {
if(DEBUG) {
- System.out.println("COMPLETION - Diet AST :"); //$NON-NLS-1$
- System.out.println(parsedUnit.toString());
+ trace("COMPLETION - Diet AST :"); //$NON-NLS-1$
+ trace(parsedUnit.toString());
}
if (parsedUnit.isModuleInfo()) {
@@ -2235,11 +2232,9 @@ public void complete(ICompilationUnit sourceUnit, int completionPosition, int po
if (e.astNode != null) {
// if null then we found a problem in the completion node
if(DEBUG) {
- System.out.print("COMPLETION - Completion node : "); //$NON-NLS-1$
- System.out.println(e.astNode.toString());
+ trace("COMPLETION - Completion node : " + e.astNode.toString()); //$NON-NLS-1$
if(this.parser.assistNodeParent != null) {
- System.out.print("COMPLETION - Parent Node : "); //$NON-NLS-1$
- System.out.println(this.parser.assistNodeParent);
+ trace("COMPLETION - Parent Node : " + this.parser.assistNodeParent); //$NON-NLS-1$
}
}
this.lookupEnvironment.unitBeingCompleted = parsedUnit; // better resilient to further error reporting
@@ -2343,8 +2338,8 @@ public void complete(ICompilationUnit sourceUnit, int completionPosition, int po
this.unitScope.throwDeferredException();
parseBlockStatements(parsedUnit, this.actualCompletionPosition);
if(DEBUG) {
- System.out.println("COMPLETION - AST :"); //$NON-NLS-1$
- System.out.println(parsedUnit.toString());
+ trace("COMPLETION - AST :"); //$NON-NLS-1$
+ trace(parsedUnit.toString());
}
parsedUnit.resolve();
}
@@ -2353,11 +2348,9 @@ public void complete(ICompilationUnit sourceUnit, int completionPosition, int po
if (e.astNode != null) {
// if null then we found a problem in the completion node
if(DEBUG) {
- System.out.print("COMPLETION - Completion node : "); //$NON-NLS-1$
- System.out.println(e.astNode.toString());
+ trace("COMPLETION - Completion node : " + e.astNode.toString()); //$NON-NLS-1$
if(this.parser.assistNodeParent != null) {
- System.out.print("COMPLETION - Parent Node : "); //$NON-NLS-1$
- System.out.println(this.parser.assistNodeParent);
+ trace("COMPLETION - Parent Node : " + this.parser.assistNodeParent); //$NON-NLS-1$
}
}
this.lookupEnvironment.unitBeingCompleted = parsedUnit; // better resilient to further error reporting
@@ -2407,8 +2400,7 @@ public void complete(ICompilationUnit sourceUnit, int completionPosition, int po
*/
} catch (IndexOutOfBoundsException | InvalidCursorLocation | AbortCompilation | CompletionNodeFound e){ // internal failure - bugs 5618
if(DEBUG) {
- System.out.println("Exception caught by CompletionEngine:"); //$NON-NLS-1$
- e.printStackTrace(System.out);
+ trace("Exception caught by CompletionEngine:", e); //$NON-NLS-1$
}
} finally {
if(!contextAccepted) {
@@ -2440,11 +2432,9 @@ private boolean completeJavadocTagInModuleInfo(CompilationUnitDeclaration parsed
if (e.astNode != null) {
// if null then we found a problem in the completion node
if(DEBUG) {
- System.out.print("COMPLETION - Completion node : "); //$NON-NLS-1$
- System.out.println(e.astNode.toString());
+ trace("COMPLETION - Completion node : " + e.astNode.toString()); //$NON-NLS-1$
if(this.parser.assistNodeParent != null) {
- System.out.print("COMPLETION - Parent Node : "); //$NON-NLS-1$
- System.out.println(this.parser.assistNodeParent);
+ trace("COMPLETION - Parent Node : " + this.parser.assistNodeParent); //$NON-NLS-1$
}
}
this.lookupEnvironment.unitBeingCompleted = parsedUnit; // better resilient to further error reporting
@@ -2605,8 +2595,8 @@ public void complete(IType type, char[] snippet, int position, char[][] localVar
typeDeclaration.fields = newFields;
if(DEBUG) {
- System.out.println("SNIPPET COMPLETION AST :"); //$NON-NLS-1$
- System.out.println(compilationUnit.toString());
+ trace("SNIPPET COMPLETION AST :"); //$NON-NLS-1$
+ trace(compilationUnit.toString());
}
if (compilationUnit.types != null) {
@@ -2649,8 +2639,7 @@ public void complete(IType type, char[] snippet, int position, char[][] localVar
}
} catch (IndexOutOfBoundsException | InvalidCursorLocation | AbortCompilation | CompletionNodeFound e){ // internal failure - bugs 5618 (added with fix of 99629)
if(DEBUG) {
- System.out.println("Exception caught by CompletionEngine:"); //$NON-NLS-1$
- e.printStackTrace(System.out);
+ trace("Exception caught by CompletionEngine:", e); //$NON-NLS-1$
}
} catch(JavaModelException e) {
// Do nothing
@@ -12012,8 +12001,7 @@ public void acceptSearchMatch(SearchMatch match) {
);
} catch (CoreException e) {
if(DEBUG) {
- System.out.println("Exception caught by CompletionEngine:"); //$NON-NLS-1$
- e.printStackTrace(System.out);
+ trace("Exception caught by CompletionEngine:", e); //$NON-NLS-1$
}
}
@@ -12990,8 +12978,9 @@ public void acceptSearchMatch(SearchMatch match) throws CoreException {
acceptTypes(scope);
}
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ trace("", e); //$NON-NLS-1$
+ }
}
if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
checkCancel();
@@ -13758,7 +13747,6 @@ protected boolean hasPossibleAnnotationTarget(TypeBinding typeBinding, Scope sco
}
/**
* Returns completion string inserted inside a specified inline tag.
- * @param completionName
* @return char[] Completion text inclunding specified inline tag
*/
private char[] inlineTagCompletion(char[] completionName, char[] inlineTag) {
@@ -14004,15 +13992,13 @@ private Initializer parseSnippeInitializer(char[] snippet, int position, char[][
}
protected void printDebug(CategorizedProblem error) {
if(CompletionEngine.DEBUG) {
- System.out.print("COMPLETION - completionFailure("); //$NON-NLS-1$
- System.out.print(error);
- System.out.println(")"); //$NON-NLS-1$
+ trace("COMPLETION - completionFailure(" + error + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
protected void printDebug(CompletionProposal proposal){
StringBuffer buffer = new StringBuffer();
printDebug(proposal, 0, buffer);
- System.out.println(buffer.toString());
+ trace(buffer.toString());
}
private void printDebug(CompletionProposal proposal, int tab, StringBuffer buffer){
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionRequestorWrapper.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionRequestorWrapper.java
index 99190f6855..641bfd9887 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionRequestorWrapper.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionRequestorWrapper.java
@@ -28,7 +28,7 @@
public class CompletionRequestorWrapper extends CompletionRequestor {
private static boolean DECODE_SIGNATURE = false;
- private org.eclipse.jdt.core.ICompletionRequestor requestor;
+ private final org.eclipse.jdt.core.ICompletionRequestor requestor;
public CompletionRequestorWrapper(org.eclipse.jdt.core.ICompletionRequestor requestor) {
this.requestor = requestor;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java
index 25d3f9eed2..caee8b2e3b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java
@@ -62,11 +62,11 @@
@SuppressWarnings({"rawtypes"})
public class CompletionUnitStructureRequestor extends CompilationUnitStructureRequestor {
- private ASTNode assistNode;
+ private final ASTNode assistNode;
- private Map bindingCache;
- private Map elementCache;
- private Map elementWithProblemCache;
+ private final Map bindingCache;
+ private final Map elementCache;
+ private final Map elementWithProblemCache;
public CompletionUnitStructureRequestor(
ICompilationUnit unit,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java
index d98a1ece40..548ff0efad 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java
@@ -69,13 +69,13 @@ public class InternalCompletionProposal extends CompletionProposal {
/**
* Kind of completion request.
*/
- private int completionKind;
+ private final int completionKind;
/**
* Offset in original buffer where ICodeAssist.codeComplete() was
* requested.
*/
- private int completionLocation;
+ private final int completionLocation;
/**
* Start position (inclusive) of source range in original buffer
@@ -135,7 +135,6 @@ public class InternalCompletionProposal extends CompletionProposal {
* in the context.
*
* Defaults to null if not set.
- *
*/
private char[][] declarationTypeVariables = null;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java
index a05cb7ffeb..e316021f81 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java
@@ -79,18 +79,18 @@ public ASTNode get(Binding binding) {
}
};
- private InternalCompletionContext completionContext;
+ private final InternalCompletionContext completionContext;
// static data
- private ITypeRoot typeRoot;
- private CompilationUnitDeclaration compilationUnitDeclaration;
- private LookupEnvironment lookupEnvironment;
- private Scope assistScope;
- private ASTNode assistNode;
- private ASTNode assistNodeParent;
- private WorkingCopyOwner owner;
-
- private CompletionParser parser;
+ private final ITypeRoot typeRoot;
+ private final CompilationUnitDeclaration compilationUnitDeclaration;
+ private final LookupEnvironment lookupEnvironment;
+ private final Scope assistScope;
+ private final ASTNode assistNode;
+ private final ASTNode assistNodeParent;
+ private final WorkingCopyOwner owner;
+
+ private final CompletionParser parser;
// computed data
private boolean hasComputedVisibleElementBindings;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java
index f16b915641..e2bf7d336f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java
@@ -45,7 +45,7 @@ public void accept(
}
private static class ResolutionCleaner extends ASTVisitor {
- private HashtableOfObjectToInt bitsMap = new HashtableOfObjectToInt();
+ private final HashtableOfObjectToInt bitsMap = new HashtableOfObjectToInt();
private boolean firstCall = true;
public ResolutionCleaner(){
@@ -167,8 +167,8 @@ public boolean visit(ParameterizedQualifiedTypeReference parameterizedQualifiedT
}
- private CompletionEngine.CompletionProblemFactory problemFactory ;
- private SearchableEnvironment nameEnvironment;
+ private final CompletionEngine.CompletionProblemFactory problemFactory ;
+ private final SearchableEnvironment nameEnvironment;
private HashMap substituedTypes;
private HashMap originalTypes;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
index 30618b0348..eb32cf2b4f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
@@ -162,7 +162,7 @@ public AcceptedType(int modifiers, char[] packageName, char[] simpleTypeName, St
}
}
- private ImportReference[] importReferences;
+ private final ImportReference[] importReferences;
private boolean importCachesNodeInitialized = false;
private ImportReference[] onDemandImportsNodeCache;
@@ -170,8 +170,8 @@ public AcceptedType(int modifiers, char[] packageName, char[] simpleTypeName, St
private char[][][] importsNodeCache;
private int importsNodeCacheCount;
- private HashtableOfObject onDemandFound = new HashtableOfObject();
- private ObjectVector notImportedFound = new ObjectVector();
+ private final HashtableOfObject onDemandFound = new HashtableOfObject();
+ private final ObjectVector notImportedFound = new ObjectVector();
public SelectionTypeNameMatchRequestorWrapper(TypeNameMatchRequestor requestor, IJavaSearchScope scope, ImportReference[] importReferences) {
super(requestor, scope);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ThrownExceptionFinder.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ThrownExceptionFinder.java
index 5847fba02d..0f4d1e66cf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ThrownExceptionFinder.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ThrownExceptionFinder.java
@@ -44,9 +44,7 @@ public class ThrownExceptionFinder extends ASTVisitor {
* Finds the thrown exceptions minus the ones that are already caught in previous catch blocks.
* Exception is already caught even if its super type is being caught. Also computes, separately,
* a list comprising of (a)those exceptions that have been caught already and (b)those exceptions that are thrown
- * by the method and whose super type has been caught already.
- * @param tryStatement
- * @param scope
+ * by the method and whose super type has been caught already.
*/
public void processThrownExceptions(TryStatement tryStatement, BlockScope scope) {
this.thrownExceptions = new SimpleSet();
@@ -107,10 +105,10 @@ public ReferenceBinding[] getAlreadyCaughtExceptions() {
this.caughtExceptions.asArray(allCaughtExceptions);
return allCaughtExceptions;
}
-
+
/**
* Returns all the thrown exceptions minus the ones that are already caught in previous catch blocks
- * (of the same try), found by the call to
+ * (of the same try), found by the call to
* {@link ThrownExceptionFinder#processThrownExceptions(TryStatement, BlockScope)}.
* @return Returns an array of thrown exceptions that are still not caught in any catch block.
*/
@@ -119,9 +117,9 @@ public ReferenceBinding[] getThrownUncaughtExceptions() {
this.thrownExceptions.asArray(result);
return result;
}
-
+
/**
- * Returns all exceptions that are discouraged to use because (a) they are already caught in some inner try-catch,
+ * Returns all exceptions that are discouraged to use because (a) they are already caught in some inner try-catch,
* or (b) their super exception has already been caught.
* @return all discouraged exceptions
*/
@@ -174,7 +172,7 @@ public boolean visit(TryStatement tryStatement, BlockScope scope) {
}
return false;
}
-
+
private void removeCaughtExceptions(TryStatement tryStatement, boolean recordUncheckedCaughtExceptions) {
Argument[] catchArguments = tryStatement.catchArguments;
int length = catchArguments == null ? 0 : catchArguments.length;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/UnresolvedReferenceNameFinder.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/UnresolvedReferenceNameFinder.java
index 2b181fa55c..948a5787e1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/UnresolvedReferenceNameFinder.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/UnresolvedReferenceNameFinder.java
@@ -45,9 +45,9 @@ public static interface UnresolvedReferenceNameRequestor {
private UnresolvedReferenceNameRequestor requestor;
- private CompletionEngine completionEngine;
- private CompletionParser parser;
- private CompletionScanner completionScanner;
+ private final CompletionEngine completionEngine;
+ private final CompletionParser parser;
+ private final CompletionScanner completionScanner;
private int parentsPtr;
private ASTNode[] parents;
@@ -56,7 +56,7 @@ public static interface UnresolvedReferenceNameRequestor {
private char[][] potentialVariableNames;
private int[] potentialVariableNameStarts;
- private SimpleSetOfCharArray acceptedNames = new SimpleSetOfCharArray();
+ private final SimpleSetOfCharArray acceptedNames = new SimpleSetOfCharArray();
public UnresolvedReferenceNameFinder(CompletionEngine completionEngine) {
this.completionEngine = completionEngine;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadoc.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadoc.java
index 6b9b99872f..bb5aafdc65 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadoc.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadoc.java
@@ -37,8 +37,6 @@ public Expression getCompletionNode() {
/**
* Resolve selected node if not null and throw exception to let clients know
* that it has been found.
- *
- * @throws CompletionNodeFound
*/
private void internalResolve(Scope scope) {
if (this.completionNode != null) {
@@ -161,8 +159,6 @@ public StringBuffer print(int indent, StringBuffer output) {
/**
* Resolve completion node if not null and throw exception to let clients know
* that it has been found.
- *
- * @throws CompletionNodeFound
*/
@Override
public void resolve(ClassScope scope) {
@@ -173,8 +169,6 @@ public void resolve(ClassScope scope) {
/**
* Resolve completion node if not null and throw exception to let clients know
* that it has been found.
- *
- * @throws CompletionNodeFound
*/
@Override
public void resolve(CompilationUnitScope scope) {
@@ -184,8 +178,6 @@ public void resolve(CompilationUnitScope scope) {
/**
* Resolve completion node if not null and throw exception to let clients know
* that it has been found.
- *
- * @throws CompletionNodeFound
*/
@Override
public void resolve(MethodScope scope) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
index 8a82459d97..3f1fb22031 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java
@@ -22,6 +22,7 @@
import org.eclipse.jdt.internal.compiler.ast.*;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.parser.JavadocParser;
+import org.eclipse.jdt.internal.compiler.parser.Scanner;
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
@@ -581,7 +582,7 @@ protected Object parseArguments(Object receiver, boolean verifySpaceOrEndComment
}
// Something wrong happened => Invalid input
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
} finally {
// we have to make sure that this is reset to the previous value even if an exception occurs
this.scanner.tokenizeWhiteSpace = tokenWhiteSpace;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNode.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNode.java
index a83862855c..25f82af5a3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNode.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNode.java
@@ -12,10 +12,9 @@
* Gayan Perera - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.codeassist.complete;
-
/**
* Marker interface for all completion nodes
*/
public interface CompletionNode {
- // marker interface
+ // Nothing to declare
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java
index 3d963a1d72..696b89bff4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java
@@ -25,7 +25,7 @@
public class CompletionNodeDetector extends ASTVisitor {
static class FindAny extends GenericAstVisitor {
- private ASTNode searchFor;
+ private final ASTNode searchFor;
boolean found;
public FindAny(ASTNode searchFor) {
@@ -49,10 +49,10 @@ public static boolean findAny(CompilationUnitDeclaration unit, ASTNode searchFor
@SuppressWarnings("serial")
static class StopTraversal extends RuntimeException { /* no details */}
- private ASTNode searchedNode;
+ private final ASTNode searchedNode;
private ASTNode parent;
private Expression outerExpression;
- private Stack interestingEnclosings = new Stack<>();
+ private final Stack interestingEnclosings = new Stack<>();
private ASTNode enclosingNode;
private boolean result;
private ASTNode blockedNode;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java
index 34c7849f18..d59ca2c286 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java
@@ -18,7 +18,7 @@
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class CompletionOnKeyword1 extends SingleTypeReference implements CompletionOnKeyword {
- private char[][] possibleKeywords;
+ private final char[][] possibleKeywords;
public CompletionOnKeyword1(char[] token, long pos, char[] possibleKeyword) {
this(token, pos, new char[][]{possibleKeyword});
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java
index 4a983baab4..32fcd6cc3c 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java
@@ -17,8 +17,8 @@
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
public class CompletionOnKeyword2 extends ImportReference implements CompletionOnKeyword {
- private char[] token;
- private char[][] possibleKeywords;
+ private final char[] token;
+ private final char[][] possibleKeywords;
public CompletionOnKeyword2(char[] token, long pos, char[][] possibleKeywords) {
super(new char[][]{token}, new long[]{pos}, false, ClassFileConstants.AccDefault);
this.token = token;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword3.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword3.java
index 6924bb6a4e..42b606b1a5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword3.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword3.java
@@ -18,8 +18,8 @@
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class CompletionOnKeyword3 extends SingleNameReference implements CompletionOnKeyword {
- private char[][] possibleKeywords;
- private boolean tryOrCatch;
+ private final char[][] possibleKeywords;
+ private final boolean tryOrCatch;
public CompletionOnKeyword3(char[] token, long pos, char[] possibleKeyword) {
this(token, pos, new char[][]{possibleKeyword}, false);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModule2.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModule2.java
index c5522ee6da..8eef66325d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModule2.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModule2.java
@@ -17,8 +17,8 @@
import org.eclipse.jdt.internal.compiler.ast.ModuleReference;
public class CompletionOnKeywordModule2 extends ModuleReference implements CompletionOnKeyword {
- private char[] token;
- private char[][] possibleKeywords;
+ private final char[] token;
+ private final char[][] possibleKeywords;
public CompletionOnKeywordModule2(char[] token, long pos, char[][] possibleKeywords) {
super(new char[][] {token}, new long[] {pos}); // dummy
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleDeclaration.java
index 9c867b6d94..81bf130d36 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleDeclaration.java
@@ -7,10 +7,10 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
- *
+ *
*******************************************************************************/
package org.eclipse.jdt.internal.codeassist.complete;
@@ -18,8 +18,8 @@
public class CompletionOnKeywordModuleDeclaration extends ModuleDeclaration implements CompletionOnKeyword {
- private char[] token;
- private char[][] possibleKeywords;
+ private final char[] token;
+ private final char[][] possibleKeywords;
public CompletionOnKeywordModuleDeclaration(char[] token, long pos, char[][] possibleKeywords) {
super(null, new char[][]{token}, new long[]{pos});
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleInfo.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleInfo.java
index ddb343acf6..cb0068da14 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleInfo.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleInfo.java
@@ -18,14 +18,14 @@
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
/**
- *
+ *
* This class is independent of its parent class and is in fact a dummy ExportsStatement. Used to hook
* into the existing module declaration type and is used as a placeholder for keyword completion. This can
* be any module keyword completion and not necessarily related to exports statement.
*/
public class CompletionOnKeywordModuleInfo extends ExportsStatement implements CompletionOnKeyword {
- private char[] token;
- private char[][] possibleKeywords;
+ private final char[] token;
+ private final char[][] possibleKeywords;
public CompletionOnKeywordModuleInfo(char[] token, long pos, char[][] possibleKeywords) {
super(new ImportReference(new char[][] {token}, new long[] {pos}, false, 0), null); // dummy
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java
index 52397359f9..e4e1973ccf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java
@@ -44,21 +44,10 @@ public class CompletionOnParameterizedQualifiedTypeReference extends Parameteriz
private int kind = K_TYPE;
public char[] completionIdentifier;
- /**
- * @param tokens
- * @param typeArguments
- * @param positions
- */
public CompletionOnParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, char[] completionIdentifier, long[] positions) {
this(tokens, typeArguments, completionIdentifier, positions, K_TYPE);
}
- /**
- * @param tokens
- * @param typeArguments
- * @param positions
- * @param kind
- */
public CompletionOnParameterizedQualifiedTypeReference(char[][] tokens, TypeReference[][] typeArguments, char[] completionIdentifier, long[] positions, int kind) {
super(tokens, typeArguments, 0, positions);
this.completionIdentifier = completionIdentifier;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
index 5587d0bba2..aba235a3b4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java
@@ -74,7 +74,6 @@ protected boolean isAtAssistIdentifier() {
/*
* Truncate the current identifier if it is containing the cursor location. Since completion is performed
* on an identifier prefix.
- *
*/
@Override
public char[] getCurrentIdentifierSource() {
@@ -364,7 +363,7 @@ protected int getNextToken0() throws InvalidInputException {
{
int test;
if ((test = getNextChar('\n', '\r')) == 0) {
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
if (test > 0) {
// relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
@@ -378,7 +377,7 @@ protected int getNextToken0() throws InvalidInputException {
break;
}
}
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
}
if (getNextChar('\'')) {
@@ -393,7 +392,7 @@ protected int getNextToken0() throws InvalidInputException {
break;
}
}
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
if (getNextChar('\\')) {
if (this.unicodeAsBackSlash) {
@@ -418,7 +417,7 @@ protected int getNextToken0() throws InvalidInputException {
&& (this.source[this.currentPosition] == 'u');
} catch(IndexOutOfBoundsException e) {
this.currentPosition--;
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
}
if (checkIfUnicode) {
getNextUnicodeChar();
@@ -441,7 +440,7 @@ protected int getNextToken0() throws InvalidInputException {
break;
}
}
- throw new InvalidInputException(INVALID_CHARACTER_CONSTANT);
+ throw invalidCharacter();
case '"' :
boolean isTextBlock = scanForTextBlockBeginning();
if (isTextBlock) {
@@ -492,7 +491,7 @@ protected int getNextToken0() throws InvalidInputException {
break;
}
if (this.currentCharacter == '\"') {
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
}
} else {
@@ -503,7 +502,7 @@ protected int getNextToken0() throws InvalidInputException {
return TokenNameStringLiteral;
}
}
- throw new InvalidInputException(INVALID_CHAR_IN_STRING);
+ throw invalidCharInString();
}
if (this.currentCharacter == '\\') {
if (this.unicodeAsBackSlash) {
@@ -551,7 +550,7 @@ protected int getNextToken0() throws InvalidInputException {
// complete inside a string literal
return TokenNameStringLiteral;
}
- throw new InvalidInputException(UNTERMINATED_STRING);
+ throw unterminatedString();
} catch (InvalidInputException e) {
if (e.getMessage().equals(INVALID_ESCAPE)) {
// relocate if finding another quote fairly close: thus unicode '/u000D' will be fully consumed
@@ -592,7 +591,7 @@ protected int getNextToken0() throws InvalidInputException {
|| c3 < 0
|| (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c4 < 0) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
} else {
this.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
}
@@ -625,7 +624,7 @@ protected int getNextToken0() throws InvalidInputException {
|| c3 < 0
|| (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
|| c4 < 0) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
} else {
this.currentCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
}
@@ -664,7 +663,7 @@ protected int getNextToken0() throws InvalidInputException {
|| (c4 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
|| c4 < 0) {
this.currentPosition = index;
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
} else {
unicodeChar = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
}
@@ -809,7 +808,7 @@ protected int getNextToken0() throws InvalidInputException {
}
} catch (IndexOutOfBoundsException e) {
this.currentPosition--;
- throw new InvalidInputException(UNTERMINATED_COMMENT);
+ throw unterminatedComment();
}
break;
}
@@ -821,7 +820,7 @@ protected int getNextToken0() throws InvalidInputException {
if (atEnd())
return TokenNameEOF;
//the atEnd may not be if source is only some part of a real (external) stream
- throw new InvalidInputException("Ctrl-Z"); //$NON-NLS-1$
+ throw invalidEof();
default :
char c = this.currentCharacter;
@@ -837,21 +836,21 @@ protected int getNextToken0() throws InvalidInputException {
boolean isJavaIdStart;
if (c >= HIGH_SURROGATE_MIN_VALUE && c <= HIGH_SURROGATE_MAX_VALUE) {
if (this.complianceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
// Unicode 4 detection
char low = (char) getNextChar();
if (low < LOW_SURROGATE_MIN_VALUE || low > LOW_SURROGATE_MAX_VALUE) {
// illegal low surrogate
- throw new InvalidInputException(INVALID_LOW_SURROGATE);
+ throw invalidLowSurrogate();
}
isJavaIdStart = ScannerHelper.isJavaIdentifierStart(this.complianceLevel, c, low);
}
else if (c >= LOW_SURROGATE_MIN_VALUE && c <= LOW_SURROGATE_MAX_VALUE) {
if (this.complianceLevel < ClassFileConstants.JDK1_5) {
- throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
+ throw invalidUnicodeEscape();
}
- throw new InvalidInputException(INVALID_HIGH_SURROGATE);
+ throw invalidHighSurrogate();
} else {
// optimized case already checked
isJavaIdStart = Character.isJavaIdentifierStart(c);
@@ -1001,7 +1000,7 @@ protected int scanForTextBlock() throws InvalidInputException {
if (lastQuotePos > 0)
this.currentPosition = lastQuotePos;
this.currentPosition = (lastQuotePos > 0) ? lastQuotePos : this.startPosition + this.rawStart;
- throw new InvalidInputException(UNTERMINATED_TEXT_BLOCK);
+ throw unterminatedTextBlock();
} catch (IndexOutOfBoundsException e) {
this.currentPosition = (lastQuotePos > 0) ? lastQuotePos : this.startPosition + this.rawStart;
if(this.startPosition <= this.cursorLocation
@@ -1009,7 +1008,7 @@ protected int scanForTextBlock() throws InvalidInputException {
// complete inside a string literal
return TokenNameStringLiteral;
}
- throw new InvalidInputException(UNTERMINATED_TEXT_BLOCK);
+ throw unterminatedTextBlock();
}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistAnnotation.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistAnnotation.java
index 34ce4e27ec..e4ef4b97be 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistAnnotation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistAnnotation.java
@@ -22,7 +22,7 @@
@SuppressWarnings("rawtypes")
public class AssistAnnotation extends Annotation {
- private Map infoCache;
+ private final Map infoCache;
public AssistAnnotation(JavaElement parent, String name, Map infoCache) {
super(parent, name);
this.infoCache = infoCache;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistCompilationUnit.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistCompilationUnit.java
index bdaa79b17a..d8900246af 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistCompilationUnit.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistCompilationUnit.java
@@ -28,8 +28,8 @@
@SuppressWarnings("rawtypes")
public class AssistCompilationUnit extends CompilationUnit {
- private Map infoCache;
- private Map bindingCache;
+ private final Map infoCache;
+ private final Map bindingCache;
public AssistCompilationUnit(ICompilationUnit compilationUnit, WorkingCopyOwner owner, Map bindingCache, Map infoCache) {
super((PackageFragment)compilationUnit.getParent(), compilationUnit.getElementName(), owner);
this.bindingCache = bindingCache;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportContainer.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportContainer.java
index 74c6e8726b..77ad37086f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportContainer.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportContainer.java
@@ -23,7 +23,7 @@
@SuppressWarnings("rawtypes")
public class AssistImportContainer extends ImportContainer {
- private Map infoCache;
+ private final Map infoCache;
public AssistImportContainer(CompilationUnit parent, Map infoCache) {
super(parent);
this.infoCache = infoCache;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportDeclaration.java
index 6f3f2506a8..d03dba300d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportDeclaration.java
@@ -22,7 +22,7 @@
@SuppressWarnings("rawtypes")
public class AssistImportDeclaration extends ImportDeclaration {
- private Map infoCache;
+ private final Map infoCache;
public AssistImportDeclaration(ImportContainer parent, String name, boolean isOnDemand, Map infoCache) {
super(parent, name, isOnDemand);
this.infoCache = infoCache;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistInitializer.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistInitializer.java
index 880c40be6f..2e9e94c1c4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistInitializer.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistInitializer.java
@@ -23,8 +23,8 @@
@SuppressWarnings("rawtypes")
public class AssistInitializer extends Initializer {
- private Map bindingCache;
- private Map infoCache;
+ private final Map bindingCache;
+ private final Map infoCache;
public AssistInitializer(JavaElement parent, int count, Map bindingCache, Map infoCache) {
super(parent, count);
this.bindingCache = bindingCache;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistPackageDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistPackageDeclaration.java
index 5235ab3a5b..1710eb5bb3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistPackageDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistPackageDeclaration.java
@@ -23,7 +23,7 @@
@SuppressWarnings("rawtypes")
public class AssistPackageDeclaration extends PackageDeclaration {
- private Map infoCache;
+ private final Map infoCache;
public AssistPackageDeclaration(CompilationUnit parent, String name, Map infoCache) {
super(parent, name);
this.infoCache = infoCache;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
index 9ec0ac8682..1751ea7a78 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
@@ -18,7 +18,6 @@
/*
* Parser extension for code assist task
- *
*/
import java.util.HashSet;
@@ -197,7 +196,6 @@ public Object becomeSimpleParser() {
}
/**
* Restore the parser as an assist parser
- * @param parserState
*/
public void restoreAssistParser(Object parserState) {
//Do nothing
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceField.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceField.java
index 3d9371267f..6bc52442fc 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceField.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceField.java
@@ -25,8 +25,8 @@
@SuppressWarnings("rawtypes")
public class AssistSourceField extends ResolvedSourceField {
- private Map bindingCache;
- private Map infoCache;
+ private final Map bindingCache;
+ private final Map infoCache;
private String uniqueKey;
private boolean isResolved;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceMethod.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceMethod.java
index 695525ab79..89e22cf9c3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceMethod.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceMethod.java
@@ -26,8 +26,8 @@
@SuppressWarnings("rawtypes")
public class AssistSourceMethod extends ResolvedSourceMethod {
- private Map bindingCache;
- private Map infoCache;
+ private final Map bindingCache;
+ private final Map infoCache;
private String uniqueKey;
private boolean isResolved;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceType.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceType.java
index 3418e9e556..2f4157b96a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceType.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceType.java
@@ -29,8 +29,8 @@
@SuppressWarnings("rawtypes")
public class AssistSourceType extends ResolvedSourceType {
- private Map bindingCache;
- private Map infoCache;
+ private final Map bindingCache;
+ private final Map infoCache;
private String uniqueKey;
private boolean isResolved;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistTypeParameter.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistTypeParameter.java
index b0a196960c..a92d08fbdd 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistTypeParameter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistTypeParameter.java
@@ -22,7 +22,7 @@
@SuppressWarnings("rawtypes")
public class AssistTypeParameter extends TypeParameter {
- private Map infoCache;
+ private final Map infoCache;
public AssistTypeParameter(JavaElement parent, String name, Map infoCache) {
super(parent, name);
this.infoCache = infoCache;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java
index 8f38859824..a369fb7e96 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java
@@ -72,8 +72,6 @@ public StringBuffer print(int indent, StringBuffer output) {
/**
* Resolve selected node if not null and throw exception to let clients know
* that it has been found.
- *
- * @throws SelectionNodeFound
*/
private void internalResolve(Scope scope) {
if (this.selectedNode != null) {
@@ -125,8 +123,6 @@ private void internalResolve(Scope scope) {
/**
* Resolve selected node if not null and throw exception to let clients know
* that it has been found.
- *
- * @throws SelectionNodeFound
*/
@Override
public void resolve(ClassScope scope) {
@@ -136,8 +132,6 @@ public void resolve(ClassScope scope) {
/**
* Resolve selected node if not null and throw exception to let clients know
* that it has been found.
- *
- * @throws SelectionNodeFound
*/
@Override
public void resolve(MethodScope scope) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java
index 4413f63f9c..1820501f89 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java
@@ -29,7 +29,6 @@
*
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.*;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java
index 4e713fba65..ccfb59f8d5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java
@@ -29,7 +29,6 @@
*
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java
index d2e1217928..285f20df89 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java
@@ -29,7 +29,6 @@
* void foo() {
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java
index a0d3b462fa..af36d4e67e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java
@@ -29,7 +29,6 @@
*
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java
index ef874f0f3a..53bfeca6ea 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java
@@ -29,7 +29,6 @@
* void foo() {
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.ImportReference;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageVisibilityReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageVisibilityReference.java
index a3fd664ad6..db03de1bc8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageVisibilityReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageVisibilityReference.java
@@ -29,7 +29,6 @@
* module myModule {
* --->
* }
- *
*/
public class SelectionOnPackageVisibilityReference extends ImportReference {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java
index d1ed320c4f..2332cfd213 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java
@@ -31,7 +31,6 @@
*
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java
index c6dd955ec9..1a3f66d72c 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java
@@ -31,7 +31,6 @@
*
* }
* }
- *
*/
import org.eclipse.jdt.core.compiler.CharOperation;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java
index 59003a59d8..be07c41ddb 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java
@@ -33,7 +33,6 @@
* }
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java
index 998b39392a..2669d6998a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java
@@ -22,7 +22,6 @@
* class X extends java.lang.[start]Object[end]
*
* ---> class X extends
- *
*/
import org.eclipse.jdt.core.compiler.CharOperation;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java
index aa772a936e..b6eb937ecd 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java
@@ -29,7 +29,6 @@
*
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java
index adca5ede29..db5db8e694 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java
@@ -22,7 +22,6 @@
* class X extends [start]Object[end]
*
* ---> class X extends
- *
*/
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.eclipse.jdt.internal.compiler.lookup.Binding;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java
index 4e835aa07c..7b3ae9c922 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java
@@ -33,7 +33,6 @@
* }
* }
* }
- *
*/
import org.eclipse.jdt.internal.compiler.ast.SuperReference;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
index 9ddd123710..a0f2cbe7be 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
@@ -386,6 +386,12 @@ protected void classInstanceCreation(boolean hasClassBody) {
this.isOrphanCompletionNode = true;
} else {
super.classInstanceCreation(hasClassBody);
+ if (this.assistNode != null) {
+ QualifiedAllocationExpression alloc = (QualifiedAllocationExpression) this.expressionStack[this.expressionPtr];
+ if (this.assistNode.sourceStart >= alloc.sourceStart && this.assistNode.sourceEnd <= alloc.sourceEnd)
+ this.selectionNodeFoundLevel = 1; // continue to parse until containing block statement is reduced, so as to
+ // ensure the type declaration makes it to the astStack (possibly as a subexpression or as an expression statement)
+ }
}
}
@Override
@@ -1852,9 +1858,25 @@ public CompilationUnitDeclaration parse(ICompilationUnit sourceUnit, Compilation
@Override
protected boolean restartRecovery() {
- return requireExtendedRecovery() || this.selectionNodeFoundLevel > 0 ?
- false :
- super.restartRecovery();
+ if (requireExtendedRecovery() || this.selectionNodeFoundLevel > 0)
+ return false;
+ boolean deferRestartOnLocalType = false;
+ for (int i = 0; i <= this.elementPtr; i++) {
+ switch (this.elementKindStack[i]) {
+ case K_INSIDE_STATEMENT_SWITCH:
+ case K_INSIDE_EXPRESSION_SWITCH:
+ case K_INSIDE_IF:
+ case K_INSIDE_WHILE:
+ deferRestartOnLocalType = true;
+ break;
+ case K_TYPE_DELIMITER:
+ if (deferRestartOnLocalType)
+ return false;
+ break;
+ }
+ }
+
+ return super.restartRecovery();
}
@Override
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionScanner.java b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionScanner.java
index 2dda5ffc6e..466d78a429 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionScanner.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionScanner.java
@@ -28,7 +28,6 @@ public class SelectionScanner extends Scanner {
/*
* Truncate the current identifier if it is containing the cursor location. Since completion is performed
* on an identifier prefix.
- *
*/
public SelectionScanner(long sourceLevel, boolean previewEnabled) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index ecf50d2c45..1d0fd41dce 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -967,7 +967,7 @@ public static CompilationUnit parseCompilationUnit(
*/
int apiLevel;
- private boolean previewEnabled;
+ private final boolean previewEnabled;
/**
* Tag bit value. This represents internal state of the tree.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
index 153ebaec72..865c9072fb 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
@@ -463,8 +463,6 @@ private void checkAndSetMalformed(ASTNode spannedNode, ASTNode spanningNode) {
}
/**
* Internal access method to SwitchCase#setExpression() for avoiding deprecated warnings
- * @param switchCase
- * @param exp
* @deprecated
*/
private static void internalSetExpression(SwitchCase switchCase, Expression exp) {
@@ -473,8 +471,6 @@ private static void internalSetExpression(SwitchCase switchCase, Expression exp)
/**
* Internal access method to SingleVariableDeclaration#setExtraDimensions() for avoiding deprecated warnings
*
- * @param node
- * @param dimensions
* @deprecated
*/
private static void internalSetExtraDimensions(SingleVariableDeclaration node, int dimensions) {
@@ -483,8 +479,6 @@ private static void internalSetExtraDimensions(SingleVariableDeclaration node, i
/**
* Internal access method to VariableDeclarationFragment#setExtraDimensions() for avoiding deprecated warnings
*
- * @param node
- * @param dimensions
* @deprecated
*/
private static void internalSetExtraDimensions(VariableDeclarationFragment node, int dimensions) {
@@ -493,8 +487,6 @@ private static void internalSetExtraDimensions(VariableDeclarationFragment node,
/**
* Internal access method to MethodDeclaration#setExtraDimension() for avoiding deprecated warnings
*
- * @param node
- * @param dimensions
* @deprecated
*/
private static void internalSetExtraDimensions(MethodDeclaration node, int dimensions) {
@@ -503,17 +495,12 @@ private static void internalSetExtraDimensions(MethodDeclaration node, int dimen
/**
* Internal access method to MethodDeclaration#thrownExceptions() for avoiding deprecated warnings
*
- * @param node
* @deprecated
*/
private static List internalThownExceptions(MethodDeclaration node) {
return node.thrownExceptions();
}
- /**
- * @param compilationUnit
- * @param comments
- */
void buildCommentsTable(CompilationUnit compilationUnit, int[][] comments) {
// Build comment table
this.commentsTable = new Comment[comments.length];
@@ -5927,9 +5914,6 @@ protected void setModifiers(AnnotationTypeMemberDeclaration annotationTypeMember
this.setModifiers(annotationTypeMemberDecl, annotationTypeMemberDeclaration.annotations, annotationTypeMemberDeclaration.sourceStart);
}
- /**
- * @param bodyDeclaration
- */
protected void setModifiers(BodyDeclaration bodyDeclaration, org.eclipse.jdt.internal.compiler.ast.Annotation[] annotations, int modifiersEnd) {
setModifiers(bodyDeclaration.modifiers(), annotations, modifiersEnd);
}
@@ -6035,10 +6019,6 @@ protected void setModifiers(EnumConstantDeclaration enumConstantDeclaration, org
}
}
- /**
- * @param fieldDeclaration
- * @param fieldDecl
- */
protected void setModifiers(FieldDeclaration fieldDeclaration, org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDecl) {
switch(this.ast.apiLevel) {
case AST.JLS2_INTERNAL :
@@ -6053,10 +6033,6 @@ protected void setModifiers(FieldDeclaration fieldDeclaration, org.eclipse.jdt.i
}
}
- /**
- * @param initializer
- * @param oldInitializer
- */
protected void setModifiers(Initializer initializer, org.eclipse.jdt.internal.compiler.ast.Initializer oldInitializer) {
switch(this.ast.apiLevel) {
case AST.JLS2_INTERNAL:
@@ -6070,10 +6046,6 @@ protected void setModifiers(Initializer initializer, org.eclipse.jdt.internal.co
this.setModifiers(initializer, oldInitializer.annotations, oldInitializer.bodyStart);
}
}
- /**
- * @param methodDecl
- * @param methodDeclaration
- */
protected void setModifiers(MethodDeclaration methodDecl, AbstractMethodDeclaration methodDeclaration) {
switch(this.ast.apiLevel) {
case AST.JLS2_INTERNAL :
@@ -6099,10 +6071,6 @@ protected void setAnnotations(ModuleDeclaration moduleDecl, org.eclipse.jdt.inte
moduleDecl.annotations().add(ie);
}
}
- /**
- * @param variableDecl
- * @param argument
- */
protected void setModifiers(SingleVariableDeclaration variableDecl, Argument argument) {
switch(this.ast.apiLevel) {
case AST.JLS2_INTERNAL :
@@ -6261,7 +6229,6 @@ protected void setModifiers(SingleVariableDeclaration variableDecl, LocalDeclara
}
/**
- * @param variableDecl
* @param component
*
* TODO: just plain copy of sM(SVD, Argument) - need to cut the flab here.
@@ -6340,10 +6307,6 @@ protected void setModifiers(SingleVariableDeclaration variableDecl, RecordCompon
}
}
}
- /**
- * @param typeDecl
- * @param typeDeclaration
- */
protected void setModifiers(TypeDeclaration typeDecl, org.eclipse.jdt.internal.compiler.ast.TypeDeclaration typeDeclaration) {
switch(this.ast.apiLevel) {
case AST.JLS2_INTERNAL :
@@ -6361,10 +6324,6 @@ protected void setModifiers(TypeDeclaration typeDecl, org.eclipse.jdt.internal.c
}
}
- /**
- * @param variableDeclarationExpression
- * @param localDeclaration
- */
protected void setModifiers(VariableDeclarationExpression variableDeclarationExpression, LocalDeclaration localDeclaration) {
switch(this.ast.apiLevel) {
case AST.JLS2_INTERNAL :
@@ -6442,10 +6401,6 @@ protected void setModifiers(VariableDeclarationExpression variableDeclarationExp
}
}
- /**
- * @param variableDeclarationStatement
- * @param localDeclaration
- */
protected void setModifiers(VariableDeclarationStatement variableDeclarationStatement, LocalDeclaration localDeclaration) {
switch(this.ast.apiLevel) {
case AST.JLS2_INTERNAL :
@@ -6692,8 +6647,6 @@ protected void setTypeForField(FieldDeclaration fieldDeclaration, Type type, int
/** extracts the subArrayType for a given declaration for AST levels less
* @param arrayType parent type
- * @param remainingDimensions
- * @param dimensionsToRemove
* @return an ArrayType
*/
private ArrayType extractSubArrayType(ArrayType arrayType, int remainingDimensions, int dimensionsToRemove) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
index 64bbd5aefb..00704b3dff 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2022 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
@@ -55,7 +55,7 @@ public class ASTMatcher {
* Indicates whether doc tags should be matched.
* @since 3.0
*/
- private boolean matchDocTags;
+ private final boolean matchDocTags;
/**
* Creates a new AST matcher instance.
@@ -1976,15 +1976,19 @@ public boolean match(ParenthesizedExpression node, Object other) {
* different node type or is null
* @since 3.26
*/
- @SuppressWarnings("deprecation")
+ @SuppressWarnings("deprecation") // GROOVY add
public boolean match(PatternInstanceofExpression node, Object other) {
if (!(other instanceof PatternInstanceofExpression)) {
return false;
}
PatternInstanceofExpression o = (PatternInstanceofExpression) other;
- return
- safeSubtreeMatch(node.getLeftOperand(), o.getLeftOperand())
- && safeSubtreeMatch(node.getRightOperand(), o.getRightOperand());
+ AST ast = node.getAST();
+ if (ast.apiLevel() <= 20) {
+ return safeSubtreeMatch(node.getLeftOperand(), o.getLeftOperand())
+ && safeSubtreeMatch(node.getRightOperand(), o.getRightOperand());
+ }
+ return safeSubtreeMatch(node.getLeftOperand(), o.getLeftOperand())
+ && safeSubtreeMatch(node.getPattern(), o.getPattern());
}
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java
index fc44454369..d3f6d043b5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java
@@ -78,10 +78,10 @@ class ASTRecoveryPropagator extends DefaultASTVisitor {
this.endingTokens.put(VariableDeclarationStatement.class, new int[]{TerminalTokens.TokenNameSEMICOLON});
}
- private CategorizedProblem[] problems;
- private boolean[] usedOrIrrelevantProblems;
+ private final CategorizedProblem[] problems;
+ private final boolean[] usedOrIrrelevantProblems;
- private RecoveryScannerData data;
+ private final RecoveryScannerData data;
private int blockDepth = 0;
private int lastEnd;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTSyntaxErrorPropagator.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTSyntaxErrorPropagator.java
index 126df88eca..4285c8ea20 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTSyntaxErrorPropagator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTSyntaxErrorPropagator.java
@@ -22,7 +22,7 @@
*/
class ASTSyntaxErrorPropagator extends ASTVisitor {
- private CategorizedProblem[] problems;
+ private final CategorizedProblem[] problems;
ASTSyntaxErrorPropagator(CategorizedProblem[] problems) {
// visit Javadoc.tags() as well
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
index efe03fe829..078d2fd0ff 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
@@ -110,7 +110,7 @@ public abstract class ASTVisitor {
* Indicates whether doc tags should be visited by default.
* @since 3.0
*/
- private boolean visitDocTags;
+ private final boolean visitDocTags;
/**
* Creates a new AST visitor instance.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTextElement.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTextElement.java
index a761ad3b9d..406363acf4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTextElement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTextElement.java
@@ -33,7 +33,6 @@ public abstract class AbstractTextElement extends ASTNode implements IDocElement
/**
* The "text" structural property of this node type (type: {@link String}).
- *
*/
public static final SimplePropertyDescriptor internalTextPropertyFactory(Class nodeClass) {
return new SimplePropertyDescriptor(nodeClass, "text", String.class, MANDATORY); //$NON-NLS-1$
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationBinding.java
index c3de8d8231..b91008cafb 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationBinding.java
@@ -31,8 +31,8 @@
*/
class AnnotationBinding implements IAnnotationBinding {
static final AnnotationBinding[] NoAnnotations = new AnnotationBinding[0];
- private org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding binding;
- private BindingResolver bindingResolver;
+ private final org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding binding;
+ private final BindingResolver bindingResolver;
private String key;
AnnotationBinding(org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding annotation, BindingResolver resolver) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java
index e8204ff6a5..50ee7e4126 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java
@@ -75,7 +75,7 @@ public static List propertyDescriptors(int apiLevel) {
* The body declarations (element type: {@link BodyDeclaration}).
* Defaults to none.
*/
- private ASTNode.NodeList bodyDeclarations =
+ private final ASTNode.NodeList bodyDeclarations =
new ASTNode.NodeList(BODY_DECLARATIONS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java
index 6cfde67889..363cfbb583 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java
@@ -104,7 +104,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of dimension expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList dimensions =
+ private final ASTNode.NodeList dimensions =
new ASTNode.NodeList(DIMENSIONS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java
index 7ed33b4104..9066d0c17e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java
@@ -71,7 +71,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList expressions =
+ private final ASTNode.NodeList expressions =
new ASTNode.NodeList(EXPRESSIONS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java
index f901e1783e..b19bc64cbc 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java
@@ -56,7 +56,7 @@ public static class Operator {
/**
* The name of the operator
*/
- private String op;
+ private final String op;
/**
* Creates a new assignment operator with the given name.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java
index 58ea6657e4..20d50ebc23 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java
@@ -36,8 +36,6 @@
@SuppressWarnings({"rawtypes", "unchecked"})
class BindingComparator {
/**
- * @param bindings
- * @param otherBindings
* @return true if both parameters are equals, false otherwise
*/
static boolean isEqual(TypeVariableBinding[] bindings, TypeVariableBinding[] otherBindings) {
@@ -63,8 +61,6 @@ static boolean isEqual(TypeVariableBinding[] bindings, TypeVariableBinding[] oth
}
/**
- * @param declaringElement
- * @param declaringElement2
* @return true if both parameters are equals, false otherwise
*/
static boolean isEqual(Binding declaringElement, Binding declaringElement2, HashSet visitedTypes) {
@@ -144,7 +140,7 @@ static boolean isEqual(org.eclipse.jdt.internal.compiler.lookup.ModuleBinding mo
return moduleBinding2 == null;
if (moduleBinding2 == null)
return false;
- return CharOperation.equals(moduleBinding.moduleName, moduleBinding2.moduleName);
+ return CharOperation.equals(moduleBinding.moduleName, moduleBinding2.moduleName);
}
static boolean isEqual(VariableBinding variableBinding, VariableBinding variableBinding2) {
@@ -163,16 +159,12 @@ && isEqual(fieldBinding.type, fieldBinding2.type, visitedTypes)
}
/**
- * @param bindings
- * @param otherBindings
* @return true if both parameters are equals, false otherwise
*/
static boolean isEqual(org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] bindings, org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] otherBindings) {
return isEqual(bindings, otherBindings, new HashSet());
}
/**
- * @param bindings
- * @param otherBindings
* @return true if both parameters are equals, false otherwise
*/
static boolean isEqual(org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] bindings, org.eclipse.jdt.internal.compiler.lookup.TypeBinding[] otherBindings, HashSet visitedTypes) {
@@ -320,8 +312,6 @@ && isEqual(referenceBinding.typeVariables(), referenceBinding2.typeVariables(),
}
}
/**
- * @param typeBinding
- * @param typeBinding2
* @return true if both parameters are equals, false otherwise
*/
static boolean isEqual(org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding, org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding2) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
index 043b8b5465..0457605974 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
@@ -165,7 +165,6 @@ IMemberValuePairBinding getMemberValuePairBinding(ElementValuePair valuePair) {
*
* @param moduleBinding the old module binding
* @return the new module binding
- *
*/
IModuleBinding getModuleBinding(org.eclipse.jdt.internal.compiler.lookup.ModuleBinding moduleBinding) {
return null;
@@ -313,7 +312,6 @@ LookupEnvironment lookupEnvironment() {
* The default implementation of this method does nothing.
* Subclasses may reimplement.
*
- * @param astNode
*/
void recordScope(ASTNode astNode, BlockScope blockScope) {
// default implementation: do nothing
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java
index 378c130354..95f7ba7d00 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java
@@ -70,7 +70,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of statements (element type: {@link Statement}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList statements =
+ private final ASTNode.NodeList statements =
new ASTNode.NodeList(STATEMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
index 8d27af0053..d35acc64c2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java
@@ -169,7 +169,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of argument expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList arguments =
+ private final ASTNode.NodeList arguments =
new ASTNode.NodeList(ARGUMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
index aa65c8c62d..bb3889846a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
@@ -169,7 +169,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of import declarations in textual order order;
* initially none (elementType: ImportDeclaration).
*/
- private ASTNode.NodeList imports =
+ private final ASTNode.NodeList imports =
new ASTNode.NodeList(IMPORTS_PROPERTY);
/**
@@ -227,7 +227,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of type declarations in textual order order;
* initially none (elementType: AbstractTypeDeclaration)
*/
- private ASTNode.NodeList types =
+ private final ASTNode.NodeList types =
new ASTNode.NodeList(TYPES_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
index d822141fbc..1ae39c1b86 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
@@ -121,7 +121,7 @@ public void add(int i) {
boolean hasCompilationAborted;
CategorizedProblem abortProblem;
- private IProgressMonitor monitor;
+ private final IProgressMonitor monitor;
/**
* Set to true if the receiver was initialized using a java project name environment
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java
index e131337e4a..57b9e49c2b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java
@@ -105,7 +105,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of argument expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList arguments =
+ private final ASTNode.NodeList arguments =
new ASTNode.NodeList(ARGUMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
index 9f53c761d8..d741476019 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
@@ -11,19 +11,11 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.dom;
-/**
- */
class DefaultASTVisitor extends ASTVisitor {
- /**
- *
- */
public DefaultASTVisitor() {
super();
}
- /**
- *
- */
public DefaultASTVisitor(boolean visitDocTags) {
super(visitDocTags);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
index cee7440580..ed8adeb5f4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
@@ -152,7 +152,7 @@ static class BindingTables {
/**
* Compilation unit scope
*/
- private CompilationUnitScope scope;
+ private final CompilationUnitScope scope;
/**
* The working copy owner that defines the context in which this resolver is creating the bindings.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java
index 806d1ca420..530ed561b7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java
@@ -188,7 +188,6 @@ public int getExtendedLength(ASTNode node) {
/**
* Return index of first leading comment of a given node.
*
- * @param node
* @return index of first leading comment or -1 if node has no leading comment
*/
int firstLeadingCommentIndex(ASTNode node) {
@@ -205,7 +204,6 @@ int firstLeadingCommentIndex(ASTNode node) {
/**
* Return index of last trailing comment of a given node.
*
- * @param node
* @return index of last trailing comment or -1 if node has no trailing comment
*/
int lastTrailingCommentIndex(ASTNode node) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java
index 5a5ea0c267..af8b951874 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java
@@ -21,7 +21,7 @@
*/
class DefaultValuePairBinding extends MemberValuePairBinding {
- private org.eclipse.jdt.internal.compiler.lookup.MethodBinding method;
+ private final org.eclipse.jdt.internal.compiler.lookup.MethodBinding method;
DefaultValuePairBinding(org.eclipse.jdt.internal.compiler.lookup.MethodBinding binding, BindingResolver resolver) {
super(null, resolver);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Dimension.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Dimension.java
index d829829634..230f12f12e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Dimension.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Dimension.java
@@ -26,7 +26,7 @@
*
extra dimension in the following node types:
* {@link SingleVariableDeclaration}, {@link VariableDeclarationFragment}, {@link MethodDeclaration}
*
- *
+ *
*
* Dimension:
* { Annotation } []
@@ -75,7 +75,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of annotations for this dimension (element type: {@link Annotation}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList annotations = new ASTNode.NodeList(ANNOTATIONS_PROPERTY);
+ private final ASTNode.NodeList annotations = new ASTNode.NodeList(ANNOTATIONS_PROPERTY);
/**
* Creates a new dimension node (supported only in level JLS8 or above).
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
index c7bab8a826..4b22c26a4f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java
@@ -35,7 +35,7 @@
class DocCommentParser extends AbstractCommentParser {
private Javadoc docComment;
- private AST ast;
+ private final AST ast;
DocCommentParser(AST ast, Scanner scanner, boolean check) {
super(null);
@@ -155,7 +155,7 @@ protected Object createArgumentReference(char[] name, int dim, boolean isVarargs
return argument;
}
catch (ClassCastException ex) {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
@@ -182,7 +182,7 @@ protected Object createFieldReference(Object receiver) throws InvalidInputExcept
return fieldRef;
}
catch (ClassCastException ex) {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
@@ -219,7 +219,7 @@ protected Object createMethodReference(Object receiver, List arguments) throws I
return methodRef;
}
catch (ClassCastException ex) {
- throw new InvalidInputException();
+ throw Scanner.invalidInput();
}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java
index 563617d2d2..6e44f164f4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java
@@ -117,7 +117,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of argument expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList arguments =
+ private final ASTNode.NodeList arguments =
new ASTNode.NodeList(ARGUMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java
index aff2b84c73..6d2ed9d9a6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java
@@ -120,7 +120,7 @@ public static List propertyDescriptors(int apiLevel) {
* The superinterface types (element type: {@link Type}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList superInterfaceTypes =
+ private final ASTNode.NodeList superInterfaceTypes =
new ASTNode.NodeList(SUPER_INTERFACE_TYPES_PROPERTY);
/**
@@ -128,7 +128,7 @@ public static List propertyDescriptors(int apiLevel) {
* (element type: {@link EnumConstantDeclaration}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList enumConstants =
+ private final ASTNode.NodeList enumConstants =
new ASTNode.NodeList(ENUM_CONSTANTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java
index a9de22677f..6d89384011 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java
@@ -141,7 +141,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of variable declaration fragments (element type:
* {@link VariableDeclarationFragment}). Defaults to an empty list.
*/
- private ASTNode.NodeList variableDeclarationFragments =
+ private final ASTNode.NodeList variableDeclarationFragments =
new ASTNode.NodeList(FRAGMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java
index cfc5826145..ef50d5684f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java
@@ -111,7 +111,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of initializer expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList initializers =
+ private final ASTNode.NodeList initializers =
new ASTNode.NodeList(INITIALIZERS_PROPERTY);
/**
@@ -123,7 +123,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of update expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList updaters =
+ private final ASTNode.NodeList updaters =
new ASTNode.NodeList(UPDATERS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java
index 295dfa0d33..6ebc4a5c8f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java
@@ -239,7 +239,6 @@ public void setExpression(Expression expression) {
/**
* Sets the pattern of this switch case.
- * @param pattern
* @noreference This method is not intended to be referenced by clients.
* @exception UnsupportedOperationException if this operation is used not for JLS18
* @exception UnsupportedOperationException if this operation is used without previewEnabled
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java
index a336b63143..c32c108779 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java
@@ -62,7 +62,7 @@ public static class Operator {
/**
* The token for the operator.
*/
- private String token;
+ private final String token;
/**
* Creates a new infix operator with the given token.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InternalASTRewrite.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InternalASTRewrite.java
index ec5eec4509..34c95e73bc 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InternalASTRewrite.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InternalASTRewrite.java
@@ -42,7 +42,7 @@
class InternalASTRewrite extends NodeEventHandler {
/** root node for the rewrite: Only nodes under this root are accepted */
- private CompilationUnit root;
+ private final CompilationUnit root;
protected final RewriteEventStore eventStore;
protected final NodeInfoStore nodeStore;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java
index 5d45767cda..14aa6f8dc3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java
@@ -69,12 +69,12 @@ public static List propertyDescriptors(int apiLevel) {
/**
* The list of types (element type: {@link Type}). Defaults to an empty list.
*/
- private ASTNode.NodeList types = new ASTNode.NodeList(TYPES_PROPERTY);
+ private final ASTNode.NodeList types = new ASTNode.NodeList(TYPES_PROPERTY);
/**
* Creates a new unparented node for an intersection type owned by the given AST.
* By default, it has no types.
- *
+ *
* N.B. This constructor is package-private.
*
*
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocRegion.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocRegion.java
index 80c1e895b5..53e78f3548 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocRegion.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocRegion.java
@@ -94,7 +94,7 @@ public class JavaDocRegion extends AbstractTagElement{
/**
* The tags list; empty for none;
*/
- private ASTNode.NodeList tags = new ASTNode.NodeList(TAGS_PROPERTY);
+ private final ASTNode.NodeList tags = new ASTNode.NodeList(TAGS_PROPERTY);
/**
* The property dummyRegion
@@ -231,7 +231,6 @@ public boolean isDummyRegion() {
/**
* Sets the value of dummyRegion property.
- * @param dummyRegion
* @exception UnsupportedOperationException if this operation is used below JLS18
*/
public void setDummyRegion(boolean dummyRegion) {
@@ -253,7 +252,6 @@ public boolean isValidSnippet() {
/**
* Sets the value of validSnippet property.
- * @param validSnippet
* @exception UnsupportedOperationException if this operation is used below JLS18
*/
public void setValidSnippet(boolean validSnippet) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java
index 1c56d89d47..6b7f9ac59a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java
@@ -117,7 +117,7 @@ public static List propertyDescriptors(int apiLevel) {
* Defaults to an empty list.
* @since 3.0
*/
- private ASTNode.NodeList tags =
+ private final ASTNode.NodeList tags =
new ASTNode.NodeList(TAGS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java
index 67774f36ed..8810129886 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java
@@ -24,14 +24,14 @@
* ( [ Identifier { , Identifier } ] )-> Body
* ( [ FormalParameter { , FormalParameter } ] )-> Body
*
- *
- *
+ *
+ *
* The first two forms use {@link VariableDeclarationFragment} for the parameter or parameters,
* while the third form uses {@link SingleVariableDeclaration}.
*
The Body can be either a {@link Block} or an {@link Expression}.
*
* @since 3.10
- * @noinstantiate This class is not intended to be instantiated by clients
+ * @noinstantiate This class is not intended to be instantiated by clients
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class LambdaExpression extends Expression {
@@ -55,7 +55,7 @@ public class LambdaExpression extends Expression {
*/
public static final ChildListPropertyDescriptor PARAMETERS_PROPERTY =
new ChildListPropertyDescriptor(LambdaExpression.class, "parameters", VariableDeclaration.class, CYCLE_RISK); //$NON-NLS-1$
-
+
/**
* The "body" structural property of this node type (child type: {@link ASTNode},
* must be either a {@link Block} or an {@link Expression}).
@@ -69,7 +69,7 @@ public class LambdaExpression extends Expression {
* or null if uninitialized.
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
-
+
static {
List propertyList = new ArrayList(4);
createPropertyList(LambdaExpression.class, propertyList);
@@ -78,7 +78,7 @@ public class LambdaExpression extends Expression {
addProperty(BODY_PROPERTY, propertyList);
PROPERTY_DESCRIPTORS_8_0 = reapPropertyList(propertyList);
}
-
+
/**
* Returns a list of structural property descriptors for this node type.
* Clients must not modify the result.
@@ -93,7 +93,7 @@ public static List propertyDescriptors(int apiLevel) {
/**
* Indicates whether parentheses are present or not.
- * Defaults to true.
+ * Defaults to true.
*/
private boolean hasParentheses = true;
@@ -102,7 +102,7 @@ public static List propertyDescriptors(int apiLevel) {
* (element type: {@link VariableDeclaration}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList parameters =
+ private final ASTNode.NodeList parameters =
new ASTNode.NodeList(PARAMETERS_PROPERTY);
/**
@@ -208,7 +208,7 @@ void accept0(ASTVisitor visitor) {
* just a single {@link VariableDeclarationFragment}.
* ASTRewrite may ignore this property if necessary.
*
- *
+ *
* @return true if this lambda expression has parentheses around
* its parameters and false otherwise
*/
@@ -250,7 +250,7 @@ public List parameters() {
/**
* Returns the body of this lambda expression.
- *
+ *
* @return the lambda expression body, which can be either a {@link Block} or an {@link Expression}
*/
public ASTNode getBody() {
@@ -315,4 +315,4 @@ int treeSize() {
+ this.parameters.listSize()
+ (this.body == null ? 0 : getBody().treeSize());
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java
index bcfcae2849..18e5736fa3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java
@@ -31,7 +31,7 @@ class MemberValuePairBinding implements IMemberValuePairBinding {
private static final Object NoValue = new Object();
private static final Object[] EmptyArray = new Object[0];
- private ElementValuePair internalPair;
+ private final ElementValuePair internalPair;
protected Object value = null;
protected BindingResolver bindingResolver;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Message.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Message.java
index fa002da3fe..df77a22c80 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Message.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Message.java
@@ -25,12 +25,12 @@ public class Message {
/**
* The message.
*/
- private String message;
+ private final String message;
/**
* The character index into the original source string, or -1 if none.
*/
- private int startPosition;
+ private final int startPosition;
/**
* The length in characters of the original source file indicating
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java
index f807e6d314..1bc18dfb8a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java
@@ -532,8 +532,8 @@ public String toString() {
*/
static class LambdaMethod extends MethodBinding {
- private MethodBinding implementation;
- private IBinding declaringMember;
+ private final MethodBinding implementation;
+ private final IBinding declaringMember;
private IVariableBinding[] syntheticOuterLocalVariables;
public LambdaMethod(DefaultBindingResolver resolver,
@@ -620,4 +620,4 @@ public boolean isSyntheticRecordMethod() {
public String[] getParameterNames() {
return CharOperation.toStrings(this.binding.parameterNames);
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
index 739eb3ced7..366d15c559 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
@@ -343,7 +343,7 @@ public static List propertyDescriptors(int apiLevel) {
* (element type: {@link SingleVariableDeclaration}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList parameters =
+ private final ASTNode.NodeList parameters =
new ASTNode.NodeList(PARAMETERS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java
index f2e812be06..e5053805cf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java
@@ -134,7 +134,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of argument expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList arguments =
+ private final ASTNode.NodeList arguments =
new ASTNode.NodeList(ARGUMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java
index d5fd31d913..830c6d2d8e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java
@@ -100,7 +100,7 @@ public static List propertyDescriptors(int apiLevel) {
* (element type: {@link MethodRefParameter}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList parameters =
+ private final ASTNode.NodeList parameters =
new ASTNode.NodeList(PARAMETERS_PROPERTY);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
index 29dc14afbb..110db75477 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
@@ -187,12 +187,12 @@ public static ModifierKeyword toKeyword(String keyword) {
/**
* The flag value for the modifier.
*/
- private int flagValue;
+ private final int flagValue;
/**
* The keyword modifier string.
*/
- private String keyword;
+ private final String keyword;
/**
* Creates a new modifier with the given keyword.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleBinding.java
index f302f6ec50..d9596898ca 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleBinding.java
@@ -30,11 +30,11 @@
class ModuleBinding implements IModuleBinding {
protected static final ITypeBinding[] NO_TYPE_BINDINGS = new ITypeBinding[0];
- private String name = null;
+ private final String name = null;
private volatile String key;
private boolean isOpen = false;
- private org.eclipse.jdt.internal.compiler.lookup.ModuleBinding binding;
+ private final org.eclipse.jdt.internal.compiler.lookup.ModuleBinding binding;
protected BindingResolver resolver;
private IAnnotationBinding[] annotations;
@@ -86,7 +86,7 @@ private IAnnotationBinding[] resolveAnnotationBindings(org.eclipse.jdt.internal.
@Override
public String getName() {
if (this.name == null) {
- char[] tmp = this.binding.moduleName;
+ char[] tmp = this.binding.moduleName;
return tmp != null && tmp.length != 0 ? new String(tmp) : Util.EMPTY_STRING;
}
return this.name;
@@ -113,7 +113,7 @@ public boolean isSynthetic() {
// TODO Auto-generated method stub
// TODO Java 9 no reference seen in jvms draft - only in sotm
// check on version change and after compiler ast implements isSynthetic return this.binding.isSynthetic();
-
+
return false;
}
@@ -238,4 +238,4 @@ public ITypeBinding[] getImplementations(ITypeBinding service) {
public String toString() {
return this.binding.toString();
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleDeclaration.java
index eace44eeda..5827b95824 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleDeclaration.java
@@ -104,9 +104,8 @@ public static List propertyDescriptors(int apiLevel) {
/**
* The annotations (element type: {@link Annotation}).
* Defaults to an empty list.
- *
*/
- private ASTNode.NodeList annotations = new ASTNode.NodeList(ANNOTATIONS_PROPERTY);
+ private final ASTNode.NodeList annotations = new ASTNode.NodeList(ANNOTATIONS_PROPERTY);
/**
* open versus normal; defaults to normal module.
@@ -123,7 +122,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of statements (element type: {@link ModuleDirective}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList moduleStatements = new ASTNode.NodeList(MODULE_DIRECTIVES_PROPERTY);
+ private final ASTNode.NodeList moduleStatements = new ASTNode.NodeList(MODULE_DIRECTIVES_PROPERTY);
ModuleDeclaration(AST ast) {
super(ast);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleModifier.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleModifier.java
index 427140e441..3d7eb9dc78 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleModifier.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleModifier.java
@@ -109,12 +109,12 @@ public static ModuleModifierKeyword toKeyword(String keyword) {
/**
* The flag value for the module modifier.
*/
- private int flagValue;
+ private final int flagValue;
/**
* The keyword module modifier string.
*/
- private String keyword;
+ private final String keyword;
/**
* Creates a new module modifier with the given keyword.
@@ -345,4 +345,4 @@ final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
int treeSize() {
return memSize();
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java
index fbea5c0134..f990051715 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java
@@ -31,7 +31,6 @@
*
* @noinstantiate This class is not intended to be instantiated by clients.
* @since 3.24
- *
*/
@SuppressWarnings("rawtypes")
public class ModuleQualifiedName extends Name {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java
index 9b0e9a2042..af6e816b8e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java
@@ -15,6 +15,8 @@
*******************************************************************************/
package org.eclipse.jdt.core.dom;
+import static org.eclipse.jdt.internal.core.JavaModelManager.trace;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.core.compiler.CharOperation;
@@ -31,7 +33,7 @@
*/
class NameEnvironmentWithProgress extends FileSystem implements INameEnvironmentWithProgress {
IProgressMonitor monitor;
-
+
public NameEnvironmentWithProgress(Classpath[] paths, String[] initialFileNames, IProgressMonitor monitor) {
super(paths, initialFileNames, false);
setMonitor(monitor);
@@ -39,7 +41,7 @@ public NameEnvironmentWithProgress(Classpath[] paths, String[] initialFileNames,
private void checkCanceled() {
if (this.monitor != null && this.monitor.isCanceled()) {
if (NameLookup.VERBOSE) {
- System.out.println(Thread.currentThread() + " CANCELLING LOOKUP "); //$NON-NLS-1$
+ trace(Thread.currentThread() + " CANCELLING LOOKUP "); //$NON-NLS-1$
}
throw new AbortCompilation(true/*silent*/, new OperationCanceledException());
}
@@ -90,7 +92,7 @@ public boolean isPackage(char[][] compoundName, char[] packageName) {
checkCanceled();
return super.isPackage(compoundName, packageName);
}
-
+
@Override
public void setMonitor(IProgressMonitor monitor) {
this.monitor = monitor;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NodeFinder.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NodeFinder.java
index 9c165b069d..9ec41326e8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NodeFinder.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NodeFinder.java
@@ -34,8 +34,8 @@ public final class NodeFinder {
* This class defines the actual visitor that finds the node.
*/
private static class NodeFinderVisitor extends ASTVisitor {
- private int fStart;
- private int fEnd;
+ private final int fStart;
+ private final int fEnd;
private ASTNode fCoveringNode;
private ASTNode fCoveredNode;
@@ -181,8 +181,8 @@ public static ASTNode perform(ASTNode root, int start, int length, ITypeRoot sou
}
return finder.getCoveringNode();
}
- private ASTNode fCoveringNode;
- private ASTNode fCoveredNode;
+ private final ASTNode fCoveringNode;
+ private final ASTNode fCoveredNode;
/**
* Instantiate a new node finder using the given root node, the given start and the given length.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java
index 4efea1700f..76ccd0bb09 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java
@@ -72,7 +72,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of member value pairs (element type:
* {@link MemberValuePair}). Defaults to an empty list.
*/
- private ASTNode.NodeList values =
+ private final ASTNode.NodeList values =
new ASTNode.NodeList(VALUES_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageBinding.java
index b2be5bc640..346ff52fb5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageBinding.java
@@ -48,9 +48,9 @@ class PackageBinding implements IPackageBinding {
private static final String UNNAMED = Util.EMPTY_STRING;
private static final char PACKAGE_NAME_SEPARATOR = '.';
- private org.eclipse.jdt.internal.compiler.lookup.PackageBinding binding;
+ private final org.eclipse.jdt.internal.compiler.lookup.PackageBinding binding;
private String name;
- private BindingResolver resolver;
+ private final BindingResolver resolver;
private String[] components;
PackageBinding(org.eclipse.jdt.internal.compiler.lookup.PackageBinding binding, BindingResolver resolver) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java
index 8bcddb717c..3595442caa 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java
@@ -89,7 +89,7 @@ public static List propertyDescriptors(int apiLevel) {
* The type arguments (element type: {@link Type}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList typeArguments =
+ private final ASTNode.NodeList typeArguments =
new ASTNode.NodeList(TYPE_ARGUMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java
index d13ea21f4e..9a6135aefe 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java
@@ -46,7 +46,7 @@ public static class Operator {
/**
* The token for the operator.
*/
- private String token;
+ private final String token;
/**
* Creates a new postfix operator with the given token.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java
index 5293330e41..dda545fb2b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java
@@ -50,7 +50,7 @@ public static class Operator {
/**
* The token for the operator.
*/
- private String token;
+ private final String token;
/**
* Creates a new prefix operator with the given token.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java
index 6450bf5c34..0b9b13cb29 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java
@@ -64,7 +64,7 @@ public static class Code {
/**
* The name of the type.
*/
- private String name;
+ private final String name;
/**
* Creates a new primitive type code with the given name.
@@ -165,7 +165,7 @@ public static PrimitiveType.Code toCode(String token) {
*/
public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY =
internalAnnotationsPropertyFactory(PrimitiveType.class);
-
+
/**
* The "primitiveTypeCode" structural property of this node type (type: {@link PrimitiveType.Code}).
* @since 3.0
@@ -191,7 +191,7 @@ public static PrimitiveType.Code toCode(String token) {
createPropertyList(PrimitiveType.class, propertyList);
addProperty(PRIMITIVE_TYPE_CODE_PROPERTY, propertyList);
PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
-
+
propertyList = new ArrayList(3);
createPropertyList(PrimitiveType.class, propertyList);
addProperty(ANNOTATIONS_PROPERTY, propertyList);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ProvidesDirective.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ProvidesDirective.java
index 8cd255189c..3152cc36b6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ProvidesDirective.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ProvidesDirective.java
@@ -23,7 +23,7 @@
*
*
* @since 3.14
- *
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients.
*/
@@ -82,7 +82,7 @@ public static List propertyDescriptors(int apiLevel) {
* (element type: {@link Name}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList implementations =
+ private final ASTNode.NodeList implementations =
new ASTNode.NodeList(IMPLEMENTATIONS_PROPERTY);
/**
@@ -223,4 +223,4 @@ int treeSize() {
+ (this.name == null ? 0 : getName().treeSize())
+ this.implementations.listSize();
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
index 25a0dfeef6..c7a8d08c73 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java
@@ -99,7 +99,6 @@ public class RecordDeclaration extends AbstractTypeDeclaration {
private int restrictedIdentifierStartPosition = -1;
/**
- * @param restrictedIdentifierStartPosition
* @since 3.26
*/
public void setRestrictedIdentifierStartPosition(int restrictedIdentifierStartPosition) {
@@ -161,7 +160,7 @@ public static List propertyDescriptors(int apiLevel) {
* The type parameters (element type: {@link TypeParameter}).
* defaults to an empty list
*/
- private ASTNode.NodeList typeParameters = new ASTNode.NodeList(TYPE_PARAMETERS_PROPERTY);
+ private final ASTNode.NodeList typeParameters = new ASTNode.NodeList(TYPE_PARAMETERS_PROPERTY);
/**
@@ -169,14 +168,14 @@ public static List propertyDescriptors(int apiLevel) {
* defaults to an empty list
* (see constructor).
*/
- private ASTNode.NodeList superInterfaceTypes = new ASTNode.NodeList(SUPER_INTERFACE_TYPES_PROPERTY);
+ private final ASTNode.NodeList superInterfaceTypes = new ASTNode.NodeList(SUPER_INTERFACE_TYPES_PROPERTY);
/**
* The parameters (element type: {@link SingleVariableDeclaration}).
* defaults to an empty list
* (see constructor).
*/
- private ASTNode.NodeList recordComponents = new ASTNode.NodeList(RECORD_COMPONENTS_PROPERTY);
+ private final ASTNode.NodeList recordComponents = new ASTNode.NodeList(RECORD_COMPONENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java
index 669556bc45..f46468bb25 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java
@@ -80,7 +80,7 @@ int getNodeType0() {
* (element type: {@link Pattern}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList patterns =
+ private final ASTNode.NodeList patterns =
new ASTNode.NodeList(PATTERNS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredPackageBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredPackageBinding.java
index 2a0859c803..11c80140e4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredPackageBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredPackageBinding.java
@@ -28,8 +28,8 @@ class RecoveredPackageBinding implements IPackageBinding {
private static final String UNNAMED = Util.EMPTY_STRING;
private static final char PACKAGE_NAME_SEPARATOR = '.';
- private PackageBinding binding;
- private BindingResolver resolver;
+ private final PackageBinding binding;
+ private final BindingResolver resolver;
private String name = null;
private String[] components = null;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java
index 11b472f62a..29acce24e4 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java
@@ -37,7 +37,7 @@ class RecoveredTypeBinding implements ITypeBinding {
private VariableDeclaration variableDeclaration;
private Type currentType;
- private BindingResolver resolver;
+ private final BindingResolver resolver;
private int dimensions;
private RecoveredTypeBinding innerTypeBinding;
private ITypeBinding[] typeArguments;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredVariableBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredVariableBinding.java
index fb5a689bf0..2997f84307 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredVariableBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredVariableBinding.java
@@ -20,8 +20,8 @@
*/
class RecoveredVariableBinding implements IVariableBinding {
- private VariableDeclaration variableDeclaration;
- private BindingResolver resolver;
+ private final VariableDeclaration variableDeclaration;
+ private final BindingResolver resolver;
RecoveredVariableBinding(BindingResolver resolver, VariableDeclaration variableDeclaration) {
this.resolver = resolver;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RequiresDirective.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RequiresDirective.java
index a0bc690c1c..433ed7f402 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RequiresDirective.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RequiresDirective.java
@@ -75,7 +75,7 @@ public static List propertyDescriptors(int apiLevel) {
* The extended modifiers (element type: {@link ModuleModifier}).
* defaults to an empty list
*/
- private ASTNode.NodeList modifiers = new ASTNode.NodeList(MODIFIERS_PROPERTY);
+ private final ASTNode.NodeList modifiers = new ASTNode.NodeList(MODIFIERS_PROPERTY);
/**
* The referenced module name; lazily initialized; defaults to a unspecified,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java
index 6c11ef7ad0..165ccb5c06 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java
@@ -120,7 +120,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of argument expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList arguments =
+ private final ASTNode.NodeList arguments =
new ASTNode.NodeList(ARGUMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java
index 432382bf5f..d773f43290 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java
@@ -135,7 +135,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of argument expressions (element type:
* {@link Expression}). Defaults to an empty list.
*/
- private ASTNode.NodeList arguments =
+ private final ASTNode.NodeList arguments =
new ASTNode.NodeList(ARGUMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java
index dca6c0d8a2..3e11380c62 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java
@@ -89,7 +89,7 @@ public static List propertyDescriptors(int apiLevel) {
* (element type: {@link Statement}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList statements =
+ private final ASTNode.NodeList statements =
new ASTNode.NodeList(STATEMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java
index f248dd428c..930e6b1aa2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java
@@ -90,7 +90,7 @@ public static List propertyDescriptors(int apiLevel) {
* (element type: {@link Statement}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList statements =
+ private final ASTNode.NodeList statements =
new ASTNode.NodeList(STATEMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
index 5b83577b9a..ff31425373 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java
@@ -308,7 +308,7 @@ final SimplePropertyDescriptor internalTagNamePropertyFactory() {
* The list of doc elements (element type: {@link TagProperty}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList tagProperties =
+ private final ASTNode.NodeList tagProperties =
new ASTNode.NodeList(TAG_PROPERTIES_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagProperty.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagProperty.java
index fd7b913ae7..b0697e5461 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagProperty.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagProperty.java
@@ -240,7 +240,6 @@ public ASTNode getNodeValue() {
/**
* Sets the name of this tag property.
*
- * @param name
* @exception UnsupportedOperationException if this operation is used below JLS18
*/
public void setName(String name) {
@@ -252,7 +251,6 @@ public void setName(String name) {
/**
* Sets the string value of this tag property.
- * @param value
* @exception UnsupportedOperationException if this operation is used below JLS18
*/
public void setStringValue(String value) {
@@ -264,7 +262,6 @@ public void setStringValue(String value) {
/**
* Sets the node value of this tag property.
- * @param value
* @exception UnsupportedOperationException if this operation is used below JLS18
*/
public void setNodeValue(ASTNode value) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java
index a21679da5d..de1e9a39d7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java
@@ -30,9 +30,9 @@
*
* Not all node arrangements will represent legal Java constructs. In particular,
* at least one resource, catch clause, or finally block must be present.
- *
+ *
*
A resource is either a {@link VariableDeclarationExpression} or (since JLS9) a {@link Name}.
- *
+ *
* @since 2.0
* @noinstantiate This class is not intended to be instantiated by clients.
* @noextend This class is not intended to be subclassed by clients.
@@ -40,7 +40,7 @@
@SuppressWarnings({"rawtypes", "unchecked"})
public class TryStatement extends Statement {
-
+
/**
* The "resources" structural property of this node type (element type: {@link VariableDeclarationExpression}) (added in JLS4 API).
* @deprecated In the JLS9 API, this property is replaced by {@link #RESOURCES2_PROPERTY}.
@@ -83,7 +83,7 @@ public class TryStatement extends Statement {
* or null if uninitialized.
*/
private static final List PROPERTY_DESCRIPTORS;
-
+
/**
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
@@ -167,7 +167,7 @@ public static List propertyDescriptors(int apiLevel) {
* The catch clauses (element type: {@link CatchClause}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList catchClauses =
+ private final ASTNode.NodeList catchClauses =
new ASTNode.NodeList(CATCH_CLAUSES_PROPERTY);
/**
@@ -360,7 +360,7 @@ public void setFinally(Block block) {
/**
* Returns the live ordered list of resources for this try statement (added in JLS4 API).
- *
+ *
*
A resource is either a {@link VariableDeclarationExpression} or (since JLS9) a {@link Name}.
*
* @return the live list of resources (element type: {@link Expression}).
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java
index b11bc305a5..7b53aed953 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java
@@ -1323,7 +1323,7 @@ public IAnnotationBinding[] getTypeAnnotations() {
static class LocalTypeBinding extends TypeBinding {
- private IBinding declaringMember;
+ private final IBinding declaringMember;
public LocalTypeBinding(BindingResolver resolver,
org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding,
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
index f259aee6ab..16cfe22b0e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java
@@ -252,7 +252,6 @@ public static List propertyDescriptors(int apiLevel) {
* The superinterface names (element type: {@link Name}).
* JLS2 only; defaults to an empty list. Not used in JLS3.
* (see constructor).
- *
*/
private ASTNode.NodeList superInterfaceNames = null;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java
index 19b450d1ef..e11897d449 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java
@@ -19,7 +19,7 @@
/**
* Type parameter declaration node (added in JLS3 API).
- *
+ *
*
* TypeParameter:
* { ExtendedModifier } Identifier [ extends Type { & Type } ]
@@ -37,7 +37,7 @@ public class TypeParameter extends ASTNode {
*/
public static final ChildListPropertyDescriptor MODIFIERS_PROPERTY =
new ChildListPropertyDescriptor(TypeParameter.class, "modifiers", IExtendedModifier.class, CYCLE_RISK); //$NON-NLS-1$
-
+
/**
* The "name" structural property of this node type (child type: {@link SimpleName}).
*/
@@ -70,7 +70,7 @@ public class TypeParameter extends ASTNode {
addProperty(NAME_PROPERTY, propertyList);
addProperty(TYPE_BOUNDS_PROPERTY, propertyList);
PROPERTY_DESCRIPTORS = reapPropertyList(propertyList);
-
+
propertyList = new ArrayList(4);
createPropertyList(TypeParameter.class, propertyList);
addProperty(MODIFIERS_PROPERTY, propertyList);
@@ -110,7 +110,7 @@ public static List propertyDescriptors(int apiLevel) {
* The type bounds (element type: {@link Type}).
* Defaults to an empty list.
*/
- private ASTNode.NodeList typeBounds =
+ private final ASTNode.NodeList typeBounds =
new ASTNode.NodeList(TYPE_BOUNDS_PROPERTY);
/**
@@ -119,7 +119,7 @@ public static List propertyDescriptors(int apiLevel) {
* (see constructor).
*/
private ASTNode.NodeList modifiers = null;
-
+
/**
* Creates a new unparented node for a parameterized type owned by the
* given AST. By default, an unspecified, but legal, type variable name,
@@ -275,7 +275,7 @@ public void setName(SimpleName typeName) {
public List typeBounds() {
return this.typeBounds;
}
-
+
/**
* Returns the live ordered list of modifiers for this TypeParameter node (added in JLS8 API).
*
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/UnionType.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/UnionType.java
index 77de29cce8..15f0fef038 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/UnionType.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/UnionType.java
@@ -69,12 +69,12 @@ public static List propertyDescriptors(int apiLevel) {
/**
* The list of types (element type: {@link Type}). Defaults to an empty list.
*/
- private ASTNode.NodeList types = new ASTNode.NodeList(TYPES_PROPERTY);
+ private final ASTNode.NodeList types = new ASTNode.NodeList(TYPES_PROPERTY);
/**
* Creates a new unparented node for an union type owned by the given AST.
* By default, it has no types.
- *
+ *
* N.B. This constructor is package-private.
*
*
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java
index 8924a4fde6..ab276164e9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java
@@ -41,11 +41,11 @@ class VariableBinding implements IVariableBinding {
private static final int VALID_MODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE |
Modifier.STATIC | Modifier.FINAL | Modifier.TRANSIENT | Modifier.VOLATILE;
- private org.eclipse.jdt.internal.compiler.lookup.VariableBinding binding;
+ private final org.eclipse.jdt.internal.compiler.lookup.VariableBinding binding;
private ITypeBinding declaringClass;
private String key;
private String name;
- private BindingResolver resolver;
+ private final BindingResolver resolver;
private ITypeBinding type;
private IAnnotationBinding[] annotations;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java
index 78da7f4e6d..a303c92ade 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java
@@ -144,7 +144,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of variable declaration fragments (element type:
* {@link VariableDeclarationFragment}). Defaults to an empty list.
*/
- private ASTNode.NodeList variableDeclarationFragments =
+ private final ASTNode.NodeList variableDeclarationFragments =
new ASTNode.NodeList(FRAGMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java
index 808bceb25d..f4e64a4bc8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java
@@ -147,7 +147,7 @@ public static List propertyDescriptors(int apiLevel) {
* The list of variable variable declaration fragments (element type:
* {@link VariableDeclarationFragment}). Defaults to an empty list.
*/
- private ASTNode.NodeList variableDeclarationFragments =
+ private final ASTNode.NodeList variableDeclarationFragments =
new ASTNode.NodeList(FRAGMENTS_PROPERTY);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
index 852f58b435..86e7a3c32f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java
@@ -40,9 +40,9 @@
@SuppressWarnings({"rawtypes", "unchecked"})
public final class ListRewrite {
- private ASTNode parent;
- private ChildListPropertyDescriptor childListProperty;
- private ASTRewrite rewriter;
+ private final ASTNode parent;
+ private final ChildListPropertyDescriptor childListProperty;
+ private final ASTRewrite rewriter;
/* package*/ ListRewrite(ASTRewrite rewriter, ASTNode parent, ChildListPropertyDescriptor childProperty) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/TargetSourceRangeComputer.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/TargetSourceRangeComputer.java
index 991bf9b338..abac91b795 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/TargetSourceRangeComputer.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/TargetSourceRangeComputer.java
@@ -51,13 +51,13 @@ public static final class SourceRange {
* 0-based character index, or -1
* if no source position information is known.
*/
- private int startPosition;
+ private final int startPosition;
/**
* (possibly 0) length, or 0
* if no source position information is known.
*/
- private int length;
+ private final int length;
/**
* Creates a new source range.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/SourceRangeVerifier.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/SourceRangeVerifier.java
index 148d3f744a..17398e8e19 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/SourceRangeVerifier.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/SourceRangeVerifier.java
@@ -40,7 +40,6 @@ public class SourceRangeVerifier extends ASTVisitor {
* nodes never overlap.
*
*
- * @param node
* @return null if everything is OK; a list of errors otherwise
*/
public String process(ASTNode node) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index 3509864d2c..56c8473caf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -35,6 +35,7 @@
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
import org.eclipse.jdt.internal.compiler.util.Util;
+import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.BlockContext;
import org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.NodeMarker;
import org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.Prefix;
@@ -160,7 +161,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
Map options;
- private RecoveryScannerData recoveryScannerData;
+ private final RecoveryScannerData recoveryScannerData;
/**
* Constructor for ASTRewriteAnalyzer.
@@ -1104,8 +1105,8 @@ class ParagraphListRewriter extends ListRewriter {
public final static int DEFAULT_SPACING= 1;
- private int initialIndent;
- private int separatorLines;
+ private final int initialIndent;
+ private final int separatorLines;
public ParagraphListRewriter(int initialIndent, int separator) {
this.initialIndent= initialIndent;
@@ -2109,7 +2110,9 @@ private int getPreviousTokenEndOffset(ASTNode node, int token) {
try {
offset = getScanner().getPreviousTokenEndOffset(token, offset);
} catch (CoreException e1) {
- e1.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e1); //$NON-NLS-1$
+ }
}
}
return offset;
@@ -2141,7 +2144,9 @@ public boolean visit(Dimension node) {
delEnd = getScanner().getNextStartOffset(delStart, false);
doTextRemove(delStart, delEnd - delStart, null); /* remove spaces after the annotation */
} catch (CoreException e) {
- e.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
}
} else if (oldAnnotationSize == 0 && newAnnotationSize > 0) { /* inserting first annotation */
if (ScannerHelper.isWhitespace(this.content[node.getStartPosition() - 1])) {
@@ -4658,7 +4663,7 @@ public boolean visit(YieldStatement node) {
}
try {
- int offset= node.isImplicit() ? node.getStartPosition() : getScanner().getTokenEndOffset(TerminalTokens.TokenNamebreak, node.getStartPosition());
+ int offset= node.isImplicit() ? node.getStartPosition() : getScanner().getTokenEndOffset(TerminalTokens.TokenNameSEMICOLON, node.getStartPosition());
if ((node.getAST().apiLevel() >= JLS14_INTERNAL)) {
rewriteNode(node, YieldStatement.EXPRESSION_PROPERTY, offset, ASTRewriteFormatter.SPACE); // space between yield and label
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
index 564a603eb2..4bed38386d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
@@ -105,7 +105,7 @@ public static String asString(ASTNode node, RewriteEventStore store) {
}
protected StringBuffer result;
- private RewriteEventStore store;
+ private final RewriteEventStore store;
public ASTRewriteFlattener(RewriteEventStore store) {
this.store= store;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
index 5da51b2c1b..d4f2dc3cc9 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java
@@ -52,7 +52,7 @@ public static class NodeMarker extends Position {
private class ExtendedFlattener extends ASTRewriteFlattener {
- private ArrayList positions;
+ private final ArrayList positions;
public ExtendedFlattener(RewriteEventStore store) {
super(store);
@@ -247,7 +247,6 @@ public TextEdit formatString(int kind, String string, int offset, int length, in
* Creates edits that describe how to format the given string. Returns null if the code could not be formatted for the given kind.
* @param node Node describing the type of the string
* @param str The unformatted string
- * @param indentationLevel
* @return Returns the edit representing the result of the formatter
* @throws IllegalArgumentException If the offset and length are not inside the string, a
* IllegalArgumentException is thrown.
@@ -455,7 +454,7 @@ public static interface BlockContext {
}
public static class ConstPrefix implements Prefix {
- private String prefix;
+ private final String prefix;
public ConstPrefix(String prefix) {
this.prefix= prefix;
@@ -468,10 +467,10 @@ public String getPrefix(int indent) {
}
private class FormattingPrefix implements Prefix {
- private int kind;
- private String string;
- private int start;
- private int length;
+ private final int kind;
+ private final String string;
+ private final int start;
+ private final int length;
public FormattingPrefix(String string, String sub, int kind) {
this.start= string.indexOf(sub);
@@ -493,8 +492,8 @@ public String getPrefix(int indent) {
}
private class BlockFormattingPrefix implements BlockContext {
- private String prefix;
- private int start;
+ private final String prefix;
+ private final int start;
public BlockFormattingPrefix(String prefix, int start) {
this.start= start;
@@ -516,9 +515,9 @@ public String[] getPrefixAndSuffix(int indent, ASTNode node, RewriteEventStore e
}
private class BlockFormattingPrefixSuffix implements BlockContext {
- private String prefix;
- private String suffix;
- private int start;
+ private final String prefix;
+ private final String suffix;
+ private final int start;
public BlockFormattingPrefixSuffix(String prefix, String suffix, int start) {
this.start= start;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java
index 5211074456..85d56537af 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java
@@ -18,9 +18,6 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-/**
- *
- */
public abstract class LineInformation {
public static LineInformation create(final IDocument doc) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java
index 9ea5b06078..2d8758bc12 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java
@@ -18,9 +18,6 @@
import org.eclipse.jdt.core.dom.ASTNode;
-/**
- *
- */
@SuppressWarnings({"rawtypes", "unchecked"})
public class ListRewriteEvent extends RewriteEvent {
@@ -29,7 +26,7 @@ public class ListRewriteEvent extends RewriteEvent {
public final static int BOTH= NEW | OLD;
/** original list of 'ASTNode' */
- private List originalNodes;
+ private final List originalNodes;
/** list of type 'RewriteEvent' */
private List listEntries;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java
index 63493fcc91..78f1835ae2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java
@@ -30,12 +30,9 @@
import org.eclipse.jdt.internal.core.dom.rewrite.RewriteEventStore.CopySourceInfo;
-/**
- *
- */
@SuppressWarnings({"rawtypes", "unchecked"})
public final class NodeInfoStore {
- private AST ast;
+ private final AST ast;
private Map placeholderNodes;
private Set collapsedNodes;
@@ -159,9 +156,6 @@ public String toString() {
}
}
- /**
- *
- */
public void clear() {
this.placeholderNodes= null;
this.collapsedNodes= null;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java
index 6b31f9fb2e..c49265dad3 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java
@@ -15,12 +15,9 @@
-/**
- *
- */
public class NodeRewriteEvent extends RewriteEvent {
- private Object originalValue;
+ private final Object originalValue;
private Object newValue;
public NodeRewriteEvent(Object originalValue, Object newValue) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java
index 813a2bcb98..e5b7fdd37b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java
@@ -14,9 +14,6 @@
package org.eclipse.jdt.internal.core.dom.rewrite;
-/**
- *
- */
public abstract class RewriteEvent {
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java
index e4ef31864e..4d0236aabd 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java
@@ -248,7 +248,7 @@ public String toString() {
*/
private class ParentIterator implements Iterator {
- private Iterator eventIter;
+ private final Iterator eventIter;
private Iterator sourceNodeIter;
private Iterator rangeNodeIter;
private Iterator trackedNodeIter;
@@ -477,8 +477,6 @@ public PropertyLocation getPropertyLocation(Object value, int kind) {
/**
* Kind is either ORIGINAL, NEW, or BOTH
- * @param value
- * @param kind
* @return Returns the event with the given value of null.
*/
public RewriteEvent findEvent(Object value, int kind) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java
index 656da6c033..0bc20e3117 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java
@@ -20,9 +20,6 @@
import org.eclipse.jdt.core.dom.rewrite.ITrackedNodePosition;
import org.eclipse.jface.text.IRegion;
-/**
- *
- */
public class TrackedNodePosition implements ITrackedNodePosition {
private final TextEditGroup group;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OnDemandComputer.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OnDemandComputer.java
index 396c85b837..e510a3bcdd 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OnDemandComputer.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OnDemandComputer.java
@@ -20,8 +20,8 @@
import java.util.Set;
class OnDemandComputer {
- private int typeOnDemandThreshold;
- private int staticOnDemandThreshold;
+ private final int typeOnDemandThreshold;
+ private final int staticOnDemandThreshold;
OnDemandComputer(int typeOnDemandThreshold, int staticOnDemandThreshold) {
this.typeOnDemandThreshold = typeOnDemandThreshold;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
index 000cf31b09..421069b9ed 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
@@ -212,7 +212,6 @@ public static void checkASTLevel(int level) {
* Calculates the JavaCore Option value string corresponding to the input ast level.
* AST Level 4 is used for Java versions 1.4 to 1.7 and is converted to compliance level 7
* if input ast level is out of boundary, latest compliance will be returned
- * @param astLevel
* @return JavaCore Option value string corresponding to the ast level
*/
public static String getCompliance(int astLevel) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEnvironment.java b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEnvironment.java
index ea376d5d17..4b5252854e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEnvironment.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEnvironment.java
@@ -20,6 +20,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.core.JavaModelManager;
/**
* An environment that wraps the client's name environment.
@@ -63,7 +64,10 @@ public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
try {
binary = new ClassFileReader(classFile.getBytes(), null);
} catch (ClassFormatException e) {
- e.printStackTrace(); // Should never happen since we compiled this type
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
+ // Should never happen since we compiled this type
return null;
}
return new NameEnvironmentAnswer(binary, null /*no access restriction*/);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEvaluator.java b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEvaluator.java
index 850d1811f8..5596ff9563 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEvaluator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEvaluator.java
@@ -27,6 +27,7 @@
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.core.JavaModelManager;
/**
* A code snippet evaluator compiles and returns class file for a code snippet.
@@ -150,7 +151,10 @@ Compiler getCompiler(ICompilerRequestor compilerRequestor) {
try {
binaryType = new ClassFileReader(globalClassFiles[i].getBytes(), null);
} catch (ClassFormatException e) {
- e.printStackTrace(); // Should never happen since we compiled this type
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
+ // Should never happen since we compiled this type
}
compiler.lookupEnvironment.cacheBinaryType(binaryType, null /*no access restriction*/);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
index 920630b2c9..f21f18d34a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java
@@ -53,7 +53,6 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
/**
* Dump the suitable return bytecode for a return statement
- *
*/
@Override
public void generateReturnBytecode(CodeStream codeStream) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java
index 12401511f9..9ac0883dd8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java
@@ -36,6 +36,7 @@
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
+import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.SearchableEnvironment;
import org.eclipse.jdt.internal.core.util.Util;
@@ -105,7 +106,7 @@ public GlobalVariable[] allVariables() {
*
* @param owner
* the owner of working copies that take precedence over their original compilation units
- *
+ *
* @param monitor
* the progress monitor used to report progress
*/
@@ -192,7 +193,10 @@ public char[] getModuleName() {
try {
binary = new ClassFileReader(classFile.getBytes(), null);
} catch (ClassFormatException e) {
- e.printStackTrace(); // Should never happen since we compiled this type
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
+ // Should never happen since we compiled this type
}
engine.lookupEnvironment.cacheBinaryType(binary, null /*no access restriction*/);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java
index 5997987142..fadc5b6c3b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java
@@ -24,6 +24,7 @@
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.core.JavaModelManager;
/**
* A variables evaluator compiles the global variables of an evaluation context and returns
@@ -167,7 +168,10 @@ Compiler getCompiler(ICompilerRequestor compilerRequestor) {
try {
binary = new ClassFileReader(classFile.getBytes(), null);
} catch (ClassFormatException e) {
- e.printStackTrace(); // Should never happen since we compiled this type
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
+ // Should never happen since we compiled this type
}
compiler.lookupEnvironment.cacheBinaryType(binary, null /*no access restriction*/);
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
index d8a5b3b551..f5ae7e982e 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -6001,7 +6001,7 @@ public static int getIndentStyle(String value) {
* @return the settings according to the Java conventions
* @since 3.0
*/
- public static Map getJavaConventionsSettings() {
+ public static Map getJavaConventionsSettings() {
return DefaultCodeFormatterOptions.getJavaConventionsSettings().getMap();
}
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java
index 88d857a454..acc77d653b 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java
@@ -22,6 +22,7 @@
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameCOMMENT_LINE;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameNotAToken;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameStringLiteral;
+import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameTextBlock;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameWHITESPACE;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamepackage;
@@ -127,7 +128,7 @@ public class CommentsPreparator extends ASTVisitor {
private int noFormatOpenTagStartIndex = -1;
private int formatCodeOpenTagEndIndex = -1;
private int lastFormatCodeClosingTagIndex = -1;
- private ArrayList commonAttributeAnnotations = new ArrayList();
+ private final ArrayList commonAttributeAnnotations = new ArrayList();
private DefaultCodeFormatter preTagCodeFormatter;
private DefaultCodeFormatter snippetCodeFormatter;
@@ -358,7 +359,7 @@ private List findStringLiteralsInLine(int lastTokenIndex) {
Token token = this.tm.get(i);
if (this.tm.countLineBreaksBetween(token, previous) > 0)
break;
- if (token.tokenType == TokenNameStringLiteral)
+ if (token.tokenType == TokenNameStringLiteral || token.tokenType == TokenNameTextBlock)
stringLiterals.add(token);
previous = token;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
index 98db506c8e..7e72d559e1 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
@@ -102,7 +102,7 @@ public class DefaultCodeFormatter extends CodeFormatter {
private List formatRegions;
private ASTNode astRoot;
- private List tokens = new ArrayList<>();
+ private final List tokens = new ArrayList<>();
private TokenManager tokenManager;
public DefaultCodeFormatter() {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
index f3b609ce77..c1befdcdd5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
@@ -148,7 +148,7 @@ public class SpacePreparator extends ASTVisitor {
}
TokenManager tm;
- private DefaultCodeFormatterOptions options;
+ private final DefaultCodeFormatterOptions options;
public SpacePreparator(TokenManager tokenManager, DefaultCodeFormatterOptions options) {
this.tm = tokenManager;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java
index b822e7729e..cf5c7e8375 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2018 Mateusz Matela and others.
+ * Copyright (c) 2014, 2023 Mateusz Matela and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -136,7 +136,7 @@ protected boolean token(Token token, int index) {
}
}
- if (token.tokenType == TokenNameStringLiteral)
+ if (token.tokenType == TokenNameStringLiteral || token.tokenType == TokenNameTextBlock)
this.stringLiteralsInLine.add(token);
if (getNext() == null) {
@@ -553,4 +553,4 @@ public List getEdits() {
public void setAlignChar(int alignChar) {
this.alignChar = alignChar;
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TokenManager.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TokenManager.java
index 28d06331da..9ceeb2c574 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TokenManager.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TokenManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2022 Mateusz Matela and others.
+ * Copyright (c) 2014, 2023 Mateusz Matela and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,6 +18,7 @@
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameNotAToken;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameStringLiteral;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameTextBlock;
+import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameIdentifier;
import java.util.ArrayList;
import java.util.HashMap;
@@ -32,6 +33,7 @@
import org.eclipse.jdt.core.dom.StringLiteral;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.InfixExpression.Operator;
+import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;
import org.eclipse.jdt.internal.formatter.Token.WrapMode;
import org.eclipse.jdt.internal.formatter.linewrap.CommentWrapExecutor;
@@ -52,7 +54,7 @@ public class TokenManager implements Iterable {
final CommentWrapExecutor commentWrapper;
private HashMap tokenIndexToNLSAlign;
- private List formatOffTagPairs = new ArrayList<>();
+ private final List formatOffTagPairs = new ArrayList<>();
private int headerEndIndex = 0;
public TokenManager(List tokens, String source, DefaultCodeFormatterOptions options) {
@@ -167,7 +169,12 @@ public int findIndex(int positionInSource, int tokenType, boolean forward) {
index--;
if (forward && get(index).originalEnd < positionInSource)
index++;
- while (tokenType >= 0 && get(index).tokenType != tokenType) {
+ Token t;
+ while (tokenType >= 0 && (t = get(index)).tokenType != tokenType) {
+ if (TerminalTokens.isRestrictedKeyword(tokenType) && t.tokenType == TokenNameIdentifier) {
+ if (tokenType == TerminalTokens.getRestrictedKeyword(toString(t)))
+ break;
+ }
index += forward ? 1 : -1;
}
return index;
@@ -243,7 +250,7 @@ public int countLineBreaksBetween(String text, int startPosition, int endPositio
return result;
}
- private TokenTraverser positionInLineCounter = new TokenTraverser() {
+ private final TokenTraverser positionInLineCounter = new TokenTraverser() {
private boolean isNLSTagInLine = false;
@Override
@@ -253,7 +260,7 @@ protected boolean token(Token traversed, int index) {
return false;
}
if (traversed.hasNLSTag()) {
- assert traversed.tokenType == TokenNameStringLiteral;
+ assert traversed.tokenType == TokenNameStringLiteral || traversed.tokenType == TokenNameTextBlock;
this.isNLSTagInLine = true;
}
if (traversed.getAlign() > 0)
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
index b347880f56..28df674e70 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
@@ -229,7 +229,7 @@ private boolean isActiveTopPriorityWrap(int index, WrapPolicy wrapPolicy) {
private class WrapsApplier extends TokenTraverser {
private final TokenManager tm2 = WrapExecutor.this.tm;
- private ArrayDeque stack = new ArrayDeque<>();
+ private final ArrayDeque stack = new ArrayDeque<>();
private int initialIndent;
private int currentIndent;
private int fixedIndentDelta;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
index 7aea8e8705..b337b2c15a 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2022 Mateusz Matela and others.
+ * Copyright (c) 2014, 2023 Mateusz Matela and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -40,6 +40,7 @@
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamenew;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameRestrictedIdentifierpermits;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamesuper;
+import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameTextBlock;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamethis;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNamethrows;
import static org.eclipse.jdt.internal.compiler.parser.TerminalTokens.TokenNameto;
@@ -239,10 +240,10 @@ public int getIdentifierIndex(TokenManager tm) {
* temporary values used when calling {@link #handleWrap(int)} to avoid ArrayList initialization and long lists of
* parameters
*/
- private List wrapIndexes = new ArrayList<>();
+ private final List wrapIndexes = new ArrayList<>();
/** Indexes for wraps that shouldn't happen but should be indented if cannot be removed */
- private List secondaryWrapIndexes = new ArrayList<>();
- private List wrapPenalties = new ArrayList<>();
+ private final List secondaryWrapIndexes = new ArrayList<>();
+ private final List wrapPenalties = new ArrayList<>();
private int wrapParentIndex = -1;
private int wrapGroupEnd = -1;
@@ -1566,7 +1567,7 @@ private void wrapComments() {
if (token.getLineBreaksBefore() > 0 || token.getLineBreaksAfter() > 0)
isNLSTagInLine = false;
if (token.hasNLSTag()) {
- assert token.tokenType == TokenNameStringLiteral;
+ assert token.tokenType == TokenNameStringLiteral || token.tokenType == TokenNameTextBlock;
isNLSTagInLine = true;
}
List structure = token.getInternalStructure();
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BindingKey.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BindingKey.java
index b8f3cb7774..5707a7cf18 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BindingKey.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BindingKey.java
@@ -28,7 +28,7 @@
*/
public final class BindingKey {
- private String key;
+ private final String key;
/**
* Creates a new binding key.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BufferChangedEvent.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BufferChangedEvent.java
index 17b11c2ed4..e6144611a7 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BufferChangedEvent.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BufferChangedEvent.java
@@ -48,17 +48,17 @@ public class BufferChangedEvent extends EventObject {
/**
* The length of text that has been modified in the buffer.
*/
- private int length;
+ private final int length;
/**
* The offset into the buffer where the modification took place.
*/
- private int offset;
+ private final int offset;
/**
* The text that was modified.
*/
- private String text;
+ private final String text;
private static final long serialVersionUID = 655379473891745999L; // backward compatible
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ElementChangedEvent.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ElementChangedEvent.java
index 86f6ba29c3..f0790310c6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ElementChangedEvent.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ElementChangedEvent.java
@@ -95,7 +95,7 @@ public class ElementChangedEvent extends EventObject {
* - PRE_AUTO_BUILD
* - POST_RECONCILE
*/
- private int type;
+ private final int type;
/**
* Creates an new element changed event (based on a IJavaElementDelta).
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
index a9c25caf0d..17b354736f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java
@@ -257,7 +257,6 @@ void codeComplete(int offset, CompletionRequestor requestor, WorkingCopyOwner ow
*
The range specified is not within this element's
* source range (INDEX_OUT_OF_BOUNDS)
*
- *
*/
IJavaElement[] codeSelect(int offset, int length) throws JavaModelException;
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IField.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IField.java
index 93caca0f80..19b8cafbe8 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IField.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IField.java
@@ -94,7 +94,6 @@ public interface IField extends IMember, IAnnotatable {
* Returns whether this field represents a record component.
*
* @return whether this field represents a record component.
- * @throws JavaModelException
* @since 3.26
*/
boolean isRecordComponent() throws JavaModelException;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java
index 3b7e74c03d..6def10a572 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java
@@ -638,7 +638,6 @@ IPackageFragmentRoot findPackageFragmentRoot(IPath path)
* @return the {@link IModuleDescription} this project owns.
* @exception JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource
- * @throws JavaModelException
* @since 3.20
*/
IModuleDescription getOwnModuleDescription() throws JavaModelException;
@@ -1150,7 +1149,6 @@ void setRawClasspath(IClasspathEntry[] entries, IClasspathEntry[] referencedEntr
* {@link #setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, IProgressMonitor)}
* If the client has not stored any referenced entries for this project, an empty array is returned.
*
- * @throws JavaModelException
* @return an array of referenced classpath entries stored for this java project or an empty array if none
* stored earlier.
* @since 3.6
@@ -1248,7 +1246,6 @@ void setRawClasspath(IClasspathEntry[] entries, IPath outputLocation, IProgressM
* @param path
* IPath
* @return the classpath entry or null.
- * @throws JavaModelException
* @since 3.14
*/
IClasspathEntry getClasspathEntryFor(IPath path) throws JavaModelException;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMethod.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMethod.java
index d0f7804856..c28b0eac69 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMethod.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMethod.java
@@ -111,7 +111,7 @@ public interface IMethod extends IMember, IAnnotatable {
*
For binary types, associated source is used to retrieve the {@link ILocalVariable#getNameRange() name range},
* {@link ILocalVariable#getSourceRange() source range} and the {@link ILocalVariable#getFlags() flags}.
*
These local variables can be used to retrieve the {@link ILocalVariable#getAnnotations() parameter annotations}.
- *
+ *
* @return the parameters of this method
* @throws JavaModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource.
@@ -263,6 +263,31 @@ public interface IMethod extends IMember, IAnnotatable {
*/
boolean isMainMethod() throws JavaModelException;
+/**
+ * Returns whether this method is a main method candidate.
+ * It is a main method if:
+ *
+ *
its name is equal to "main"
+ *
its return type is void
+ *
it is static and public
+ *
it defines one parameter whose type's simple name is String[]
+ *
+ * Starting with Java 21 there is "preview feature" that allows instance main methods.
+ * It is a main method according to this JEP if:
+ *
+ *
its name is equal to "main"
+ *
its return type is void
+ *
it is non-private
+ *
it defines one parameter whose type's simple name is String[] or no parameter at all
+ *
+ *
+ * @exception JavaModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @since 3.36
+ * @return true if this method is a main method, false otherwise
+ */
+boolean isMainMethodCandidate() throws JavaModelException;
+
/**
* Returns whether this method represents a lambda expression.
*
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModularClassFile.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModularClassFile.java
index d67fe823ba..0156e8e67c 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModularClassFile.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModularClassFile.java
@@ -24,7 +24,6 @@ public interface IModularClassFile extends IClassFile {
* Returns the module description contained in this type root.
* An error-free {@link IModularClassFile} should always have a module.
*
- * @throws JavaModelException
* @return the module description contained in the type root.
*/
@Override
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModuleDescription.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModuleDescription.java
index bf5eed5c96..a364029b88 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModuleDescription.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModuleDescription.java
@@ -36,21 +36,19 @@ public interface IModuleDescription extends IMember, IAnnotatable {
* @since 3.14
*/
String[] getRequiredModuleNames() throws JavaModelException;
-
+
/**
* Get provided service names for this module.
*
* @return a non-null array of provided service names
- * @throws JavaModelException
* @since 3.18
*/
String[] getProvidedServiceNames() throws JavaModelException;
-
+
/**
* Get used service names for this module.
*
* @return a non-null array of used service names
- * @throws JavaModelException
* @since 3.18
*/
String[] getUsedServiceNames() throws JavaModelException;
@@ -60,7 +58,6 @@ public interface IModuleDescription extends IMember, IAnnotatable {
*
* @param targetModule filter the result to include only packages exported to the given module, unless {@code null}.
* @return a non-null array of exported package names
- * @throws JavaModelException
* @since 3.18
*/
String[] getExportedPackageNames(IModuleDescription targetModule) throws JavaModelException;
@@ -70,13 +67,12 @@ public interface IModuleDescription extends IMember, IAnnotatable {
*
* @param targetModule filter the result to include only packages opened to the given module, unless {@code null}.
* @return a non-null array of opened package names
- * @throws JavaModelException
* @since 3.18
*/
String[] getOpenedPackageNames(IModuleDescription targetModule) throws JavaModelException;
/**
- *
+ *
* @return true if automatic module, else false
* @since 3.14
*/
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeRoot.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeRoot.java
index 1556b177bf..e1c77781b2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeRoot.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeRoot.java
@@ -41,7 +41,6 @@ public interface ITypeRoot extends IJavaElement, IParent, IOpenable, ISourceRefe
* in this type root.
*
Only subtype {@link IModularClassFile} promises to return non-null.
*
- * @throws JavaModelException
* @since 3.14
* @return the module description contained in the type root or null.
*/
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index 983bf40675..7d50caa241 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -114,6 +114,8 @@
package org.eclipse.jdt.core;
+import static org.eclipse.jdt.internal.core.JavaModelManager.trace;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -3878,8 +3880,7 @@ private static ClasspathContainerInitializer computeClasspathContainerInitialize
} catch(CoreException e) {
// executable extension could not be created: ignore this initializer
if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
- verbose_failed_to_instanciate_container_initializer(containerID, configurationElement);
- e.printStackTrace();
+ verbose_failed_to_instanciate_container_initializer(containerID, configurationElement, e);
}
}
}
@@ -3889,16 +3890,16 @@ private static ClasspathContainerInitializer computeClasspathContainerInitialize
return null;
}
- private static void verbose_failed_to_instanciate_container_initializer(String containerID, IConfigurationElement configurationElement) {
- Util.verbose(
+ private static void verbose_failed_to_instanciate_container_initializer(String containerID, IConfigurationElement configurationElement, CoreException e) {
+ trace(
"CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$
" container ID: " + containerID + '\n' + //$NON-NLS-1$
" class: " + configurationElement.getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$
- System.err);
+ e);
}
private static void verbose_found_container_initializer(String containerID, IConfigurationElement configurationElement) {
- Util.verbose(
+ trace(
"CPContainer INIT - found initializer\n" + //$NON-NLS-1$
" container ID: " + containerID + '\n' + //$NON-NLS-1$
" class: " + configurationElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -3959,7 +3960,7 @@ public static IPath getClasspathVariable(final String variableName) {
ok = true;
} catch (RuntimeException | Error e) {
if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE)
- e.printStackTrace();
+ trace("", new Exception(e)); //$NON-NLS-1$
throw e;
} finally {
if (!ok) JavaModelManager.getJavaModelManager().variablePut(variableName, null); // flush cache
@@ -3972,36 +3973,34 @@ public static IPath getClasspathVariable(final String variableName) {
}
private static void verbose_no_variable_initializer_found(String variableName) {
- Util.verbose(
+ trace(
"CPVariable INIT - no initializer found\n" + //$NON-NLS-1$
" variable: " + variableName); //$NON-NLS-1$
}
private static void verbose_variable_value_after_initialization(String variableName, IPath variablePath) {
- Util.verbose(
+ trace(
"CPVariable INIT - after initialization\n" + //$NON-NLS-1$
" variable: " + variableName +'\n' + //$NON-NLS-1$
" variable path: " + variablePath); //$NON-NLS-1$
}
private static void verbose_triggering_variable_initialization(String variableName, ClasspathVariableInitializer initializer) {
- Util.verbose(
+ trace(
"CPVariable INIT - triggering initialization\n" + //$NON-NLS-1$
" variable: " + variableName + '\n' + //$NON-NLS-1$
" initializer: " + initializer); //$NON-NLS-1$
}
private static void verbose_triggering_variable_initialization_invocation_trace() {
- Util.verbose(
+ trace(
"CPVariable INIT - triggering initialization\n" + //$NON-NLS-1$
- " invocation trace:"); //$NON-NLS-1$
- new Exception("").printStackTrace(System.out); //$NON-NLS-1$
+ " invocation trace:", new Exception("")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* Returns deprecation message of a given classpath variable.
*
- * @param variableName
* @return A string if the classpath variable is deprecated, null otherwise.
* @since 3.3
*/
@@ -4088,8 +4087,7 @@ public static ClasspathVariableInitializer getClasspathVariableInitializer(Strin
} catch(CoreException e){
// executable extension could not be created: ignore this initializer
if (JavaModelManager.CP_RESOLVE_VERBOSE || JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
- verbose_failed_to_instanciate_variable_initializer(variable, configElement);
- e.printStackTrace();
+ verbose_failed_to_instanciate_variable_initializer(variable, configElement, e);
}
}
}
@@ -4098,16 +4096,16 @@ public static ClasspathVariableInitializer getClasspathVariableInitializer(Strin
return null;
}
- private static void verbose_failed_to_instanciate_variable_initializer(String variable, IConfigurationElement configElement) {
- Util.verbose(
+ private static void verbose_failed_to_instanciate_variable_initializer(String variable, IConfigurationElement configElement, CoreException e) {
+ trace(
"CPContainer INIT - failed to instanciate initializer\n" + //$NON-NLS-1$
" variable: " + variable + '\n' + //$NON-NLS-1$
" class: " + configElement.getAttribute("class"), //$NON-NLS-1$ //$NON-NLS-2$
- System.err);
+ e);
}
private static void verbose_found_variable_initializer(String variable, IConfigurationElement configElement) {
- Util.verbose(
+ trace(
"CPVariable INIT - found initializer\n" + //$NON-NLS-1$
" variable: " + variable + '\n' + //$NON-NLS-1$
" class: " + configElement.getAttribute("class")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -4251,7 +4249,9 @@ public static IResource[] getGeneratedResources(IRegion region, boolean includes
outputLocation = entryOutputLocation;
}
} catch (JavaModelException e) {
- e.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ trace("", e); //$NON-NLS-1$
+ }
}
if (outputLocation == null) continue;
IContainer container = (IContainer) project.getWorkspace().getRoot().findMember(outputLocation);
@@ -4710,16 +4710,18 @@ public static void initializeAfterLoad(IProgressMonitor monitor) throws CoreExce
String newVersionNumber = Byte.toString(State.VERSION);
if (!newVersionNumber.equals(versionNumber)) {
// build state version number has changed: touch every projects to force a rebuild
- if (JavaBuilder.DEBUG)
- System.out.println("Build state version number has changed"); //$NON-NLS-1$
+ if (JavaBuilder.DEBUG) {
+ trace("Build state version number has changed"); //$NON-NLS-1$
+ }
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor progressMonitor2) throws CoreException {
for (int i = 0, length = projects.length; i < length; i++) {
IJavaProject project = projects[i];
try {
- if (JavaBuilder.DEBUG)
- System.out.println("Touching " + project.getElementName()); //$NON-NLS-1$
+ if (JavaBuilder.DEBUG) {
+ trace("Touching " + project.getElementName()); //$NON-NLS-1$
+ }
new ClasspathValidation((JavaProject) project).validate(); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=287164
project.getProject().touch(progressMonitor2);
} catch (CoreException e) {
@@ -4781,7 +4783,6 @@ public void acceptType(
/**
* Returns whether a given classpath variable is read-only or not.
*
- * @param variableName
* @return true if the classpath variable is read-only,
* false otherwise.
* @since 3.3
@@ -5881,7 +5882,6 @@ public static void removePreProcessingResourceChangedListener(IResourceChangeLis
*
* @param monitor a progress monitor, or null if progress
* reporting and cancellation are not desired
- * @throws CoreException
* @since 3.13
*/
public static void rebuildIndex(IProgressMonitor monitor) throws CoreException {
@@ -6016,7 +6016,6 @@ public static void run(IWorkspaceRunnable action, ISchedulingRule rule, IProgres
* @param affectedProjects - the set of projects for which this container is being bound
* @param respectiveContainers - the set of respective containers for the affected projects
* @param monitor a monitor to report progress
- * @throws JavaModelException
* @see ClasspathContainerInitializer
* @see #getClasspathContainer(IPath, IJavaProject)
* @see IClasspathContainer
@@ -6054,7 +6053,6 @@ public static void setClasspathContainer(IPath containerPath, IJavaProject[] aff
*
* @param variableName the name of the classpath variable
* @param path the path
- * @throws JavaModelException
* @see #getClasspathVariable(String)
*
* @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead
@@ -6083,7 +6081,6 @@ public static void setClasspathVariable(String variableName, IPath path)
* @param variableName the name of the classpath variable
* @param path the path
* @param monitor a monitor to report progress
- * @throws JavaModelException
* @see #getClasspathVariable(String)
*/
public static void setClasspathVariable(
@@ -6122,7 +6119,6 @@ public static void setClasspathVariable(
* @param paths an array of path updates for the modified classpath variables (null
* meaning that the corresponding value will be removed
* @param monitor a monitor to report progress
- * @throws JavaModelException
* @see #getClasspathVariable(String)
* @since 2.0
*/
@@ -6311,7 +6307,6 @@ public static int compareJavaVersions(String first, String second) {
* @param project
* the project whose referenced modules to be computed
* @return an array of String containing module names
- * @throws CoreException
* @since 3.14
*/
public static String[] getReferencedModules(IJavaProject project) throws CoreException {
@@ -6329,7 +6324,6 @@ public static String[] getReferencedModules(IJavaProject project) throws CoreExc
*
* @return the IModuleDescription representing this java element as an automatic module,
* never null.
- * @throws JavaModelException
* @throws IllegalArgumentException if the provided element is neither IPackageFragmentRoot
* nor IJavaProject
* @since 3.14
@@ -6379,7 +6373,6 @@ public static List defaultRootModules(Iterable all
* @param classFileAttributes map of attribute names and values to be used during class file generation
* @return the compiled byte code
*
- * @throws JavaModelException
* @throws IllegalArgumentException if the map of classFileAttributes contains an unsupported key.
* @since 3.14
*/
@@ -6478,7 +6471,6 @@ public void stop(BundleContext context) throws Exception {
* Registers the JavaModelManager as a resource changed listener and save participant.
* Starts the background indexing, and restore saved classpath variable values.
*
- * @throws Exception
* @see org.eclipse.core.runtime.Plugin#start(BundleContext)
*/
@Override
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/SourceRange.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/SourceRange.java
index c8883edaa4..320935fd47 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/SourceRange.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/SourceRange.java
@@ -37,8 +37,8 @@ public static boolean isAvailable(ISourceRange range) { // see https://bugs.ecli
return range != null && range.getOffset() != -1;
}
- private int offset;
- private int length;
+ private final int offset;
+ private final int length;
/**
* Instantiate a new source range using the given offset and the given length.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
index 78e8b3739c..8e45e49e88 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java
@@ -358,7 +358,7 @@ public static IClassFileReader createDefaultClassFileReader(String zipFileName,
ZipFile zipFile = null;
try {
if (JavaModelManager.ZIP_ACCESS_VERBOSE) {
- System.out.println("(" + Thread.currentThread() + ") [ToolFactory.createDefaultClassFileReader()] Creating ZipFile on " + zipFileName); //$NON-NLS-1$ //$NON-NLS-2$
+ JavaModelManager.trace("(" + Thread.currentThread() + ") [ToolFactory.createDefaultClassFileReader()] Creating ZipFile on " + zipFileName); //$NON-NLS-1$ //$NON-NLS-2$
}
zipFile = new ZipFile(zipFileName);
ZipEntry zipEntry = zipFile.getEntry(zipEntryName);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java
index 33fef4cd56..d76c27b820 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java
@@ -52,8 +52,8 @@
@SuppressWarnings({"rawtypes"})
public class ReconcileContext {
- private ReconcileWorkingCopyOperation operation;
- private CompilationUnit workingCopy;
+ private final ReconcileWorkingCopyOperation operation;
+ private final CompilationUnit workingCopy;
/**
* Creates a reconcile context for the given reconcile operation.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/provisional/JavaModelAccess.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/provisional/JavaModelAccess.java
index 0bdc298098..207fe2a9ab 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/provisional/JavaModelAccess.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/core/provisional/JavaModelAccess.java
@@ -23,7 +23,7 @@
/**
* Provisional API for use by JDT/UI or JDT/Debug, which may possibly be removed in a future version.
- * See Bug 522391.
+ * See Bug 522391.
*/
public class JavaModelAccess {
/**
@@ -38,17 +38,16 @@ public static String[] getRequiredModules(IModuleDescription module) throws Java
}
/**
- * Returns the IModuleDescription that the given java element contains
+ * Returns the IModuleDescription that the given java element contains
* when regarded as an automatic module. The element must be an IPackageFragmentRoot
* or an IJavaProject.
- *
+ *
*
The returned module descriptor has a name (getElementName()) following
* the specification of java.lang.module.ModuleFinder.of(Path...), but it
* contains no other useful information.
- *
+ *
* @return the IModuleDescription representing this java element as an automatic module,
* never null.
- * @throws JavaModelException
* @throws IllegalArgumentException if the provided element is neither IPackageFragmentRoot
* nor IJavaProject
* @since 3.14
@@ -67,7 +66,7 @@ public static IModuleDescription getAutomaticModuleDescription(IJavaElement elem
/**
* Answer whether the given module is a system module.
*
This provisional API may likely be changed into a direct method {@code IModuleDescription.isSystemModule()}.
- *
+ *
* @param module the module being queried about
* @return {@code true} iff the module is defined in the system library (also known as JRE).
* @since 3.18
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java
index 1c12f0b3e0..ee9e7da3db 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java
@@ -97,7 +97,6 @@ void acceptInitializer(
* of the parse action, so as to allow computation of normalized ranges.
*
* A line separator might corresponds to several characters in the source,
- *
*/
void acceptLineSeparatorPositions(int[] positions);
/**
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
index a8b17e6f17..aa3968b73f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java
@@ -191,7 +191,6 @@ public static class FieldInfo {
* the parse action, so as to allow computation of normalized ranges.
*
* A line separator might corresponds to several characters in the source,
- *
*/
void acceptLineSeparatorPositions(int[] positions);
@@ -243,4 +242,12 @@ default void enterModule(ModuleInfo info) {
default void exitModule(int declarationEnd) {
// do nothing
}
+
+ default void enterCompactConstructor(MethodInfo methodInfo) {
+ // do nothing
+ }
+
+ default void exitCompactConstructor(int declarationEnd) {
+ // do nothing
+ }
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java
index 83381b4290..0ae22e7fcb 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java
@@ -255,8 +255,8 @@ protected void notifySourceElementRequestor(AbstractMethodDeclaration methodDecl
this.visitIfNeeded(methodDeclaration);
return;
}
- if ((methodDeclaration.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.IsImplicit) != 0)
- return;
+
+ final boolean isImplicit = (methodDeclaration.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.IsImplicit) != 0;
if (methodDeclaration.isDefaultConstructor()) {
if (this.reportReferenceInfo) {
@@ -329,7 +329,11 @@ protected void notifySourceElementRequestor(AbstractMethodDeclaration methodDecl
methodInfo.declaringTypeModifiers = declaringType.modifiers;
methodInfo.extraFlags = ExtraFlags.getExtraFlags(declaringType);
methodInfo.node = methodDeclaration;
- this.requestor.enterConstructor(methodInfo);
+ if(isImplicit) {
+ this.requestor.enterCompactConstructor(methodInfo);
+ } else {
+ this.requestor.enterConstructor(methodInfo);
+ }
}
if (this.reportReferenceInfo) {
ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
@@ -354,7 +358,11 @@ protected void notifySourceElementRequestor(AbstractMethodDeclaration methodDecl
}
this.visitIfNeeded(methodDeclaration);
if (isInRange){
- this.requestor.exitConstructor(methodDeclaration.declarationSourceEnd);
+ if(isImplicit) {
+ this.requestor.exitCompactConstructor(methodDeclaration.declarationSourceEnd);
+ } else {
+ this.requestor.exitConstructor(methodDeclaration.declarationSourceEnd);
+ }
}
return;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
index da5057dd31..8dd483f170 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
@@ -27,7 +27,6 @@
* | not take advantage of remote field constant inlining.
* | Given the intended purpose of the conversion is to resolve references, this is not
* | a problem.
- *
*/
import org.codehaus.jdt.groovy.integration.LanguageSupportFactory;
@@ -73,7 +72,7 @@ static class AnonymousMemberFound extends RuntimeException {
public static final int LOCAL_TYPE = 0x20;
public static final int NONE = 0;
- private int flags;
+ private final int flags;
private CompilationUnitDeclaration unit;
private Parser parser;
private ICompilationUnit cu;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java
index 2b1951fe26..f6073fdad5 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java
@@ -41,7 +41,7 @@ public abstract class TypeConverter {
protected ProblemReporter problemReporter;
protected boolean has1_5Compliance;
protected boolean has14_Compliance;
- private char memberTypeSeparator;
+ private final char memberTypeSeparator;
protected TypeConverter(ProblemReporter problemReporter, char memberTypeSeparator) {
this.problemReporter = problemReporter;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AbstractModule.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AbstractModule.java
index b95f900110..515072ed0d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AbstractModule.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AbstractModule.java
@@ -28,15 +28,15 @@
import org.eclipse.jdt.internal.compiler.env.IModule.IService;
public interface AbstractModule extends IModuleDescription {
-
+
/**
* Handle for an automatic module.
*
*
Note, that by definition this is mostly a fake, only {@link #getElementName()} provides a useful value.
*/
static class AutoModule extends NamedMember implements AbstractModule {
-
- private boolean nameFromManifest;
+
+ private final boolean nameFromManifest;
public AutoModule(JavaElement parent, String name, boolean nameFromManifest) {
super(parent, name);
@@ -75,7 +75,7 @@ public void toStringContent(StringBuffer buffer, String lineDelimiter) throws Ja
buffer.append(this.name);
}
}
-
+
// "forward declaration" for a method from JavaElement:
abstract Object getElementInfo() throws JavaModelException;
@@ -123,7 +123,7 @@ default IPackageExport[] getExportedPackages() throws JavaModelException {
default IService[] getProvidedServices() throws JavaModelException {
return getModuleInfo().provides();
}
- @Override
+ @Override
default String[] getProvidedServiceNames() throws JavaModelException {
ArrayList results = new ArrayList<>();
IService[] services = getProvidedServices();
@@ -131,12 +131,12 @@ default String[] getProvidedServiceNames() throws JavaModelException {
results.add(new String(service.name()));
}
return results.toArray(new String[0]);
-
+
}
default char[][] getUsedServices() throws JavaModelException {
return getModuleInfo().uses();
}
- @Override
+ @Override
default String[] getUsedServiceNames() throws JavaModelException {
ArrayList results = new ArrayList<>();
char[][] services = getUsedServices();
@@ -144,7 +144,7 @@ default String[] getUsedServiceNames() throws JavaModelException {
char[] service = services[i];
results.add(new String(service));
}
- return results.toArray(new String[0]);
+ return results.toArray(new String[0]);
}
default IPackageExport[] getOpenedPackages() throws JavaModelException {
return getModuleInfo().opens();
@@ -160,8 +160,9 @@ default String toString(String lineDelimiter) {
try {
toStringContent(buffer, lineDelimiter);
} catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
}
return buffer.toString();
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
index 16183556d7..f11348094f 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
@@ -655,6 +655,11 @@ public boolean isConstructor() throws JavaModelException {
public boolean isMainMethod() throws JavaModelException {
return this.isMainMethod(this);
}
+
+@Override
+public boolean isMainMethodCandidate() throws JavaModelException {
+ return this.isMainMethodCandidate(this);
+}
/*
* @see IMethod#isLambdaMethod()
*/
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryModule.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryModule.java
index 02053a1b07..bb319ebbe6 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryModule.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryModule.java
@@ -136,9 +136,10 @@ public String toString(String lineDelimiter) {
try {
toStringContent(buffer, lineDelimiter);
} catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
}
return buffer.toString();
}
-}
\ No newline at end of file
+}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
index 07ed1f29de..90c0e7ba88 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java
@@ -140,8 +140,8 @@ public void codeComplete(
engine.complete(this, snippet, position, localVariableTypeNames, localVariableNames, localVariableModifiers, isStatic);
}
if (NameLookup.VERBOSE) {
- System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ JavaModelManager.trace(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ JavaModelManager.trace(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java
index 191e06280e..6274f75bfd 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java
@@ -48,8 +48,8 @@
*/
public class BinaryTypeConverter extends TypeConverter {
- private CompilationResult compilationResult;
- private HashSetOfCharArrayArray typeNames;
+ private final CompilationResult compilationResult;
+ private final HashSetOfCharArrayArray typeNames;
public BinaryTypeConverter(ProblemReporter problemReporter, CompilationResult compilationResult, HashSetOfCharArrayArray typeNames) {
super(problemReporter, Signature.C_DOLLAR);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferCache.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferCache.java
index 043f930dd9..2af2df7854 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferCache.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferCache.java
@@ -24,7 +24,7 @@
*/
public class BufferCache extends OverflowingLRUCache {
- private ThreadLocal> buffersToClose = new ThreadLocal<>();
+ private final ThreadLocal> buffersToClose = new ThreadLocal<>();
/**
* Constructs a new buffer cache of the given size.
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferManager.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferManager.java
index 99c4a7993b..589bf62db2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferManager.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferManager.java
@@ -34,7 +34,7 @@ public class BufferManager {
* LRU cache of buffers. The key and value for an entry
* in the table is the identical buffer.
*/
- private BufferCache openBuffers = new BufferCache<>(60);
+ private final BufferCache openBuffers = new BufferCache<>(60);
/**
* @deprecated
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
index 77043eb3da..19c7c68c87 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
@@ -216,7 +216,7 @@ public IBinaryType getBinaryTypeInfo() throws JavaModelException {
} catch (ClassFormatException cfe) {
//the structure remains unknown
if (JavaCore.getPlugin().isDebugging()) {
- cfe.printStackTrace(System.err);
+ JavaModelManager.trace("", cfe); //$NON-NLS-1$
}
return null;
} catch (IOException ioe) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAttribute.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAttribute.java
index 3b7fed047a..0f58cdc4cf 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAttribute.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAttribute.java
@@ -18,8 +18,8 @@
public class ClasspathAttribute implements IClasspathAttribute {
- private String name;
- private String value;
+ private final String name;
+ private final String value;
public ClasspathAttribute(String name, String value) {
this.name = name;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java
index da4c355431..f1b6c4543d 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java
@@ -15,6 +15,8 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core;
+import static org.eclipse.jdt.internal.core.JavaModelManager.trace;
+
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
@@ -290,7 +292,7 @@ public int generateDelta(JavaElementDelta delta, boolean addClasspathChange) {
deltaProcessor.projectCachesToReset.add(this.project);
} catch (JavaModelException e) {
if (DeltaProcessor.VERBOSE) {
- e.printStackTrace();
+ trace("", e); //$NON-NLS-1$
}
// project no longer exist
return result;
@@ -459,8 +461,9 @@ public int generateDelta(JavaElementDelta delta, boolean addClasspathChange) {
delta.removed(frag);
}
} catch (JavaModelException e) {
- if (DeltaProcessor.VERBOSE)
- e.printStackTrace();
+ if (DeltaProcessor.VERBOSE) {
+ trace("", e); //$NON-NLS-1$
+ }
}
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
index f868e62670..a9831e4d40 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -22,6 +22,7 @@
import static org.eclipse.jdt.internal.compiler.util.Util.UTF_8;
import static org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray;
+import static org.eclipse.jdt.internal.core.JavaModelManager.trace;
import java.io.File;
import java.io.IOException;
@@ -161,16 +162,16 @@ public AssertionFailedException(String message) {
/**
* Patterns allowing to include/exclude portions of the resource tree denoted by this entry path.
*/
- private IPath[] inclusionPatterns;
+ private final IPath[] inclusionPatterns;
private volatile char[][] fullInclusionPatternChars;
- private IPath[] exclusionPatterns;
+ private final IPath[] exclusionPatterns;
private volatile char[][] fullExclusionPatternChars;
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$
public final static ClasspathEntry[] NO_ENTRIES = new ClasspathEntry[0];
private final static IPath[] NO_PATHS = new IPath[0];
private final static IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- private boolean combineAccessRules;
+ private final boolean combineAccessRules;
private String rootID;
private AccessRuleSet accessRuleSet;
@@ -983,14 +984,14 @@ private static void resolvedChainedLibraries(IPath jarPath, HashSet visited, Arr
String calledFileName = (String) calledFilesIterator.next();
if (!directoryPath.isValidPath(calledFileName)) {
if (JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
- Util.verbose("Invalid Class-Path entry " + calledFileName + " in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$
+ trace("Invalid Class-Path entry " + calledFileName + " in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
IPath calledJar = directoryPath.append(new Path(calledFileName));
// Ignore if segment count is Zero (https://bugs.eclipse.org/bugs/show_bug.cgi?id=308150)
if (calledJar.segmentCount() == 0) {
if (JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
- Util.verbose("Invalid Class-Path entry " + calledFileName + " in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$
+ trace("Invalid Class-Path entry " + calledFileName + " in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$ //$NON-NLS-2$
}
continue;
}
@@ -1042,20 +1043,19 @@ private static List getCalledFileNames(IPath jarPath) {
calledFileNames = analyzer.getCalledFileNames();
if (!success || analyzer.getClasspathSectionsCount() == 1 && calledFileNames == null) {
if (JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
- Util.verbose("Invalid Class-Path header in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$
+ trace("Invalid Class-Path header in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$
}
return null;
} else if (analyzer.getClasspathSectionsCount() > 1) {
if (JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
- Util.verbose("Multiple Class-Path headers in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$
+ trace("Multiple Class-Path headers in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$
}
return null;
}
} catch (CoreException | IOException e) {
// not a zip file
if (JavaModelManager.CP_RESOLVE_VERBOSE_FAILURE) {
- Util.verbose("Could not read Class-Path header in manifest of jar file: " + jarPath.toOSString()); //$NON-NLS-1$
- e.printStackTrace();
+ trace("Could not read Class-Path header in manifest of jar file: " + jarPath.toOSString(), e); //$NON-NLS-1$
}
}
return calledFileNames;
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java
index 14a914f846..68b52be5d2 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java
@@ -27,7 +27,7 @@
*/
public class ClasspathValidation {
- private JavaProject project;
+ private final JavaProject project;
public ClasspathValidation(JavaProject project) {
this.project = project;
@@ -64,9 +64,9 @@ public void validate() {
if (!status.isOK())
this.project.createClasspathProblemMarker(status);
- // update overlapping output problem markers
+ // update overlapping output problem markers
this.project.flushClasspathProblemMarkers(false/*cycle*/, false/*format*/, true/*overlapping*/);
-
+
// update resolved classpath problems
this.project.flushClasspathProblemMarkers(false/*cycle*/, false/*format*/, false/*overlapping*/);
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
index 89a781c4aa..8cfb0cae53 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
@@ -502,8 +502,9 @@ public void destroy() {
try {
discardWorkingCopy();
} catch (JavaModelException e) {
- if (JavaModelManager.VERBOSE)
- e.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
}
}
@@ -1466,8 +1467,9 @@ public char[] getModuleName() {
if (module != null)
return module.getElementName().toCharArray();
} catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ if (JavaModelManager.VERBOSE) {
+ JavaModelManager.trace("", e); //$NON-NLS-1$
+ }
}
return null;
}
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
index 7a72ca616b..a575806349 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java
@@ -313,8 +313,8 @@ public static CompilationUnitDeclaration process(
problems.put(IJavaModelMarker.TASK_MARKER, categorizedProblems);
}
if (NameLookup.VERBOSE) {
- System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ JavaModelManager.trace(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
+ JavaModelManager.trace(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
} catch (OperationCanceledException e) {
diff --git a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
index 630106781a..d3f2cca135 100644
--- a/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
+++ b/jdt-patch/e430/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java
@@ -83,13 +83,13 @@ public class CompilationUnitStructureRequestor extends ReferenceInfoAdapter impl
/*
* A table from a handle (with occurenceCount == 1) to the current occurence count for this handle
*/
- private HashMap