Skip to content

Commit

Permalink
Eclipse 4.30 (M3) JDT Patch for Groovy-Eclipse
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Nov 10, 2023
1 parent 1813370 commit 7f5b698
Show file tree
Hide file tree
Showing 595 changed files with 5,135 additions and 3,999 deletions.
2 changes: 1 addition & 1 deletion groovy-eclipse.setup
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
<repository
url="https://download.eclipse.org/eclipse/updates/4.30"/>
<repository
url="https://download.eclipse.org/eclipse/updates/4.30-I-builds/I20230927-1800"/>
url="https://download.eclipse.org/eclipse/updates/4.30-I-builds/I20231109-0710"/>
</repositoryList>
<repositoryList
name="2023-09">
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</license>

<requires>
<import feature="org.eclipse.jdt" version="3.19.300.v20230927-1806" patch="true"/>
<import feature="org.eclipse.jdt" version="3.19.300.v20231109-0710" patch="true"/>
</requires>

<plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*/
import java.io.BufferedReader;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ protected Commandline setupJavacCommand() throws BuildException {

/**
* Get the compiler arguments
* @param javacClass
* @return String[] the array of arguments
*/
private String[] processCompilerArguments(Class javacClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,6 @@ public static String charToString(char[] charArray) {
* Converts the given list of strings to an array of equal size,
* containing the individual strings converted to char[] each.
*
* @param stringList
* @return an array of char[], representing the elements in the input list, or {@code null} if the list was {@code null}.
* @since 3.14
*/
Expand Down Expand Up @@ -1981,8 +1980,6 @@ public static final boolean contains(char[] characters, char[] array) {

/**
* Does the given array contain a char sequence that is equal to the give sequence?
* @param array
* @param sequence
* @return true if sequence is equal to an element in array
* @since 3.14
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2554,6 +2554,12 @@ public interface IProblem {
*/
int CannotInferRecordPatternTypes = PreviewRelated + 1940;

/**
* @since 3.36
*/
int IllegalRecordPattern = TypeRelated + 1941;


/**
* @since 3.35
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,31 +287,17 @@ public void endVisit(LongLiteral longLiteral, BlockScope scope) {
// do nothing by default
}
/**
* @param annotation
* @param scope
* @since 3.1
*/
public void endVisit(MarkerAnnotation annotation, BlockScope scope) {
// do nothing by default
}
/**
* @param annotation
* @param scope
*/
public void endVisit(MarkerAnnotation annotation, ClassScope scope) {
// do nothing by default
}
/**
* @param pair
* @param scope
*/
public void endVisit(MemberValuePair pair, BlockScope scope) {
// do nothing by default
}
/**
* @param pair
* @param scope
*/
public void endVisit(MemberValuePair pair, ClassScope scope) {
// do nothing by default
}
Expand All @@ -325,8 +311,6 @@ public void endVisit(StringLiteralConcatenation literal, BlockScope scope) {
// do nothing by default
}
/**
* @param annotation
* @param scope
* @since 3.1
*/
public void endVisit(NormalAnnotation annotation, BlockScope scope) {
Expand Down Expand Up @@ -414,17 +398,11 @@ public void endVisit(ReturnStatement returnStatement, BlockScope scope) {
// do nothing by default
}
/**
* @param annotation
* @param scope
* @since 3.1
*/
public void endVisit(SingleMemberAnnotation annotation, BlockScope scope) {
// do nothing by default
}
/**
* @param annotation
* @param scope
*/
public void endVisit(SingleMemberAnnotation annotation, ClassScope scope) {
// do nothing by default
}
Expand Down Expand Up @@ -807,32 +785,20 @@ public boolean visit(LongLiteral longLiteral, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
/**
* @param annotation
* @param scope
* @since 3.1
*/
public boolean visit(MarkerAnnotation annotation, BlockScope scope) {
return true;
}
/**
* @param annotation
* @param scope
*/
public boolean visit(MarkerAnnotation annotation, ClassScope scope) {
return true;
}
/**
* @param pair
* @param scope
* @since 3.1
*/
public boolean visit(MemberValuePair pair, BlockScope scope) {
return true;
}
/**
* @param pair
* @param scope
*/
public boolean visit(MemberValuePair pair, ClassScope scope) {
return true;
}
Expand All @@ -848,17 +814,11 @@ public boolean visit(
return true; // do nothing by default, keep traversing
}
/**
* @param annotation
* @param scope
* @since 3.1
*/
public boolean visit(NormalAnnotation annotation, BlockScope scope) {
return true;
}
/**
* @param annotation
* @param scope
*/
public boolean visit(NormalAnnotation annotation, ClassScope scope) {
return true;
}
Expand Down Expand Up @@ -938,17 +898,11 @@ public boolean visit(ReturnStatement returnStatement, BlockScope scope) {
return true; // do nothing by default, keep traversing
}
/**
* @param annotation
* @param scope
* @since 3.1
*/
public boolean visit(SingleMemberAnnotation annotation, BlockScope scope) {
return true;
}
/**
* @param annotation
* @param scope
*/
public boolean visit(SingleMemberAnnotation annotation, ClassScope scope) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public abstract class AbstractAnnotationProcessorManager {
* @param compiler the given compiler
* @param compilationUnitLocator the given compilation unit locator
* @param javaProject the given java project
* @param isTestCode
*/
public abstract void configureFromPlatform(Compiler compiler, Object compilationUnitLocator, Object javaProject, boolean isTestCode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
import org.eclipse.jdt.internal.compiler.problem.AbortMethod;
import org.eclipse.jdt.internal.compiler.problem.AbortType;
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
import org.eclipse.jdt.internal.compiler.problem.ShouldNotImplement;
import org.eclipse.jdt.internal.compiler.util.Messages;
Expand Down Expand Up @@ -2038,9 +2039,6 @@ public void completeCodeAttributeForClinit(
}


/**
*
*/
public void completeCodeAttributeForMissingAbstractProblemMethod(
MethodBinding binding,
int codeAttributeOffset,
Expand Down Expand Up @@ -2277,9 +2275,10 @@ public void completeCodeAttributeForSyntheticMethod(
if (exceptionLabel != null) {
int iRange = 0, maxRange = exceptionLabel.getCount();
if ((maxRange & 1) != 0) {
this.referenceBinding.scope.problemReporter().abortDueToInternalError(
ProblemReporter problemReporter = this.referenceBinding.scope.problemReporter();
problemReporter.abortDueToInternalError(
Messages.bind(Messages.abort_invalidExceptionAttribute, new String(binding.selector),
this.referenceBinding.scope.problemReporter().referenceContext));
problemReporter.referenceContext));
}
while (iRange < maxRange) {
int start = exceptionLabel.ranges[iRange++]; // even ranges are start positions
Expand Down Expand Up @@ -3309,9 +3308,6 @@ private void generateElementValue(
}
}
}
/**
* @param attributeOffset
*/
private void generateElementValue(int attributeOffset, Expression defaultValue, Constant constant, TypeBinding binding) {
if (this.contentsOffset + 3 >= this.contents.length) {
resizeContents(3);
Expand Down Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class CompilationResult {
public ICompilationUnit compilationUnit;
private Map<CategorizedProblem, ReferenceContext> problemsMap;
private Set firstErrors;
private int maxProblemPerUnit;
private final int maxProblemPerUnit;
public char[][][] qualifiedReferences;
public char[][] simpleNameReferences;
public char[][] rootReferences;
Expand All @@ -87,6 +87,7 @@ public class CompilationResult {
private int numberOfErrors;
private boolean hasMandatoryErrors;
public List<AnnotationBinding[]> annotations = new ArrayList<>(1);
private List<Runnable> scheduledProblems;

private static final int[] EMPTY_LINE_ENDS = Util.EMPTY_INT_ARRAY;
private static final Comparator PROBLEM_COMPARATOR = new Comparator() {
Expand Down Expand Up @@ -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();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.io.*;
import java.util.*;

@SuppressWarnings("rawtypes")
public class Compiler implements ITypeRequestor, ProblemSeverities {
public Parser parser;
public ICompilerRequestor requestor;
Expand Down Expand Up @@ -162,7 +161,7 @@ public Compiler(
public Compiler(
INameEnvironment environment,
IErrorHandlingPolicy policy,
Map settings,
Map<String, String> settings,
final ICompilerRequestor requestor,
IProblemFactory problemFactory,
boolean parseLiteralExpressionsAsConstants) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class DefaultErrorHandlingPolicies {
*
* Typically, the #proceedWithProblems(Problem[]) should
* show the problems.
*
*/
public static IErrorHandlingPolicy exitAfterAllProblems() {
return new IErrorHandlingPolicy() {
Expand All @@ -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() {
Expand All @@ -61,7 +59,6 @@ public boolean ignoreAllErrors() {
}
/*
* Proceed on the first error met.
*
*/
public static IErrorHandlingPolicy proceedOnFirstError() {
return new IErrorHandlingPolicy() {
Expand All @@ -81,7 +78,6 @@ public boolean ignoreAllErrors() {
}
/*
* Accumulate all problems, then proceed with them.
*
*/
public static IErrorHandlingPolicy proceedWithAllProblems() {
return new IErrorHandlingPolicy() {
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public abstract class BaseProcessingEnvImpl implements ProcessingEnvironment {
// Initialized in this base class:
protected Elements _elementUtils;
protected Types _typeUtils;
private List<ICompilationUnit> _addedUnits;
private List<ReferenceBinding> _addedClassFiles;
private List<ICompilationUnit> _deletedUnits;
private final List<ICompilationUnit> _addedUnits;
private final List<ReferenceBinding> _addedClassFiles;
private final List<ICompilationUnit> _deletedUnits;
private boolean _errorRaised;
private Factory _factory;
private final Factory _factory;
public ModuleBinding _current_module;

public BaseProcessingEnvImpl() {
Expand Down
Loading

0 comments on commit 7f5b698

Please sign in to comment.