Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Mar 8, 2022
1 parent ef6a80a commit c6ef59c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1520,9 +1520,7 @@ protected void finishedResolution() {
// GRECLIPSE end

private void addFatalError(final String text, final ASTNode node) {
source.getErrorCollector().addFatalError(
org.codehaus.groovy.control.messages.Message.create(new SyntaxException(text, node), source)
);
source.addFatalError(text, node);
}

private void checkCyclicInheritance(final ClassNode node, final ClassNode type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,21 +345,11 @@ public void addError(SyntaxException se) throws CompilationFailedException {
* @param msg the error message
* @param node the AST node
* @throws CompilationFailedException on error
*
* @since 3.0.0
*/
public void addFatalError(String msg, ASTNode node) throws CompilationFailedException {
getErrorCollector().addFatalError(
new SyntaxErrorMessage(
new SyntaxException(
msg,
node.getLineNumber(),
node.getColumnNumber(),
node.getLastLineNumber(),
node.getLastColumnNumber()
),
this
)
);
getErrorCollector().addFatalError(Message.create(new SyntaxException(msg, node), this));
}

public void addErrorAndContinue(SyntaxException se) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
import static org.codehaus.groovy.ast.ClassHelper.double_TYPE;
import static org.codehaus.groovy.ast.ClassHelper.findSAM;
import static org.codehaus.groovy.ast.ClassHelper.float_TYPE;
import static org.codehaus.groovy.ast.ClassHelper.getNextSuperClass;
import static org.codehaus.groovy.ast.ClassHelper.getUnwrapper;
import static org.codehaus.groovy.ast.ClassHelper.getWrapper;
import static org.codehaus.groovy.ast.ClassHelper.int_TYPE;
Expand All @@ -120,7 +121,6 @@
import static org.codehaus.groovy.ast.ClassHelper.makeWithoutCaching;
import static org.codehaus.groovy.ast.ClassHelper.short_TYPE;
import static org.codehaus.groovy.ast.ClassHelper.void_WRAPPER_TYPE;
import static org.codehaus.groovy.ast.tools.GenericsUtils.makeClassSafe0;
import static org.codehaus.groovy.ast.tools.WideningCategories.isBigIntCategory;
import static org.codehaus.groovy.ast.tools.WideningCategories.isFloatingCategory;
import static org.codehaus.groovy.ast.tools.WideningCategories.isNumberCategory;
Expand Down Expand Up @@ -1460,7 +1460,7 @@ private static boolean typeCheckMethodsWithGenerics(final ClassNode receiver, fi
// GROOVY-8034: non-static method may use class generics
gts = applyGenericsContext(candidateGenerics, gts);
}
GenericsUtils.extractPlaceholders(makeClassSafe0(OBJECT_TYPE, gts), candidateGenerics);
GenericsUtils.extractPlaceholders(GenericsUtils.makeClassSafe0(OBJECT_TYPE, gts), candidateGenerics);

// the outside context parts till now define placeholder we are not allowed to
// generalize, thus we save that for later use...
Expand Down Expand Up @@ -1740,12 +1740,11 @@ static void extractGenericsConnections(final Map<GenericsTypeName, GenericsType>
ClassNode returnType = StaticTypeCheckingVisitor.wrapTypeIfNecessary(GenericsUtils.parameterizeSAM(target).getV2());
extractGenericsConnections(connections, type.getGenericsTypes(), new GenericsType[] {returnType.asGenericsType()});

} else if (type.equals(target) || !implementsInterfaceOrIsSubclassOf(type, target)) {
} else if (type.equals(target)) {
extractGenericsConnections(connections, type.getGenericsTypes(), target.getGenericsTypes());

} else {
// find matching super class or interface
ClassNode superClass = GenericsUtils.getSuperClass(type, target);
} else if (implementsInterfaceOrIsSubclassOf(type, target)) {
ClassNode superClass = getNextSuperClass(type, target);
if (superClass != null) {
if (GenericsUtils.hasUnresolvedGenerics(superClass)) {
Map<String, ClassNode> spec = GenericsUtils.createGenericsSpec(type);
Expand Down Expand Up @@ -1928,8 +1927,8 @@ static ClassNode getCombinedBoundType(final GenericsType genericsType) {
}

static GenericsType getCombinedGenericsType(final GenericsType gt1, final GenericsType gt2) {
ClassNode cn1 = makeClassSafe0(CLASS_Type, gt1);
ClassNode cn2 = makeClassSafe0(CLASS_Type, gt2);
ClassNode cn1 = GenericsUtils.makeClassSafe0(CLASS_Type, gt1);
ClassNode cn2 = GenericsUtils.makeClassSafe0(CLASS_Type, gt2);
ClassNode lub = lowestUpperBound(cn1,cn2);
return lub.getGenericsTypes()[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,10 @@ && isAssignment(enclosingBinaryExpression.getOperation().getType())) {
} else if (!resultType.isGenericsPlaceHolder()) { // GROOVY-10324
Map<GenericsTypeName, GenericsType> gt = new HashMap<>();
extractGenericsConnections(gt, resultType, resultType.redirect());
extractGenericsConnections(gt, lType, getNextSuperClass(resultType, lType));
ClassNode sc = resultType;
do { sc = getNextSuperClass(sc, lType);
} while (sc != null && !sc.equals(lType));
extractGenericsConnections(gt, lType, sc);

resultType = applyGenericsContext(gt, resultType.redirect());// GROOVY-10235, et al.
}
Expand Down Expand Up @@ -3124,7 +3127,6 @@ private void doInferClosureParameterTypes(final ClassNode receiver, final Expres
} else {
for (int i = 0, n = closureParams.length; i < n; i += 1) {
Parameter closureParam = closureParams[i];
ClassNode declaredType = closureParam.getOriginType();
ClassNode inferredType = OBJECT_TYPE;
if (i < inferred.length - 1 || inferred.length == n) {
inferredType = inferred[i];
Expand Down
6 changes: 3 additions & 3 deletions extras/groovy-eclipse-batch-builder/build.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# version numbers
version2.5=2.5.16-02
version2.5=2.5.16-01
version3.0=3.0.10-02
version4.0=4.0.1-02

Expand All @@ -9,10 +9,10 @@ version4.0=4.0.1-02
do-40-build=true

# location of the plugins directory for the eclipse install
eclipse.install.plugins=C:/Users/Public/Eclipse-4.22/plugins
eclipse.install.plugins=C:/Users/Public/Eclipse-4.23/plugins

# location of the cloned groovy-eclipse git repository
git.repo.loc=C:/Users/Name/workspace/groovy-eclipse

# which JDT Core patch is active in your workspace?
jdt.patch.target=e422
jdt.patch.target=e423

0 comments on commit c6ef59c

Please sign in to comment.