Skip to content

Commit f7b348c

Browse files
committed
Fixed or suppressed some more warnings
1 parent 359a306 commit f7b348c

27 files changed

Lines changed: 328 additions & 1024 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33
<parent>
4-
<relativePath>../pom.xml</relativePath>
4+
<relativePath>../pom.xml</relativePath>
55
<groupId>org.codehaus.groovy.eclipse</groupId>
66
<artifactId>org.codehaus.groovy.eclipse.base-test.parent</artifactId>
77
<version>2.9.2-SNAPSHOT</version>
@@ -10,4 +10,4 @@
1010
<artifactId>org.eclipse.jdt.groovy.core.tests.compiler</artifactId>
1111
<version>3.3.100-SNAPSHOT</version>
1212
<packaging>eclipse-plugin</packaging>
13-
</project>
13+
</project>

base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
import org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer;
6060

6161
public abstract class AbstractRegressionTest extends AbstractCompilerTest implements StopableTestCase {
62-
// javac comparison related types, fields and methods - see runJavac for
63-
// details
62+
// javac comparison related types, fields and methods - see runJavac for details
6463
static class JavacCompiler {
6564
String rootDirectoryPath;
6665
String javacPathName;
@@ -121,6 +120,8 @@ static class JavacCompiler {
121120
this.version = JavaCore.VERSION_1_6;
122121
} else if (rawVersion.indexOf("1.7") != -1) {
123122
this.version = JavaCore.VERSION_1_7;
123+
} else if (rawVersion.indexOf("1.8") != -1) {
124+
this.version = JavaCore.VERSION_1_8;
124125
} else {
125126
throw new RuntimeException("unknown javac version: " + rawVersion);
126127
}
@@ -821,6 +822,8 @@ protected void compileAndDeploy(String source, String directoryName, String clas
821822
buffer.append("\" -1.6");
822823
} else if (this.complianceLevel == ClassFileConstants.JDK1_7) {
823824
buffer.append("\" -1.7");
825+
} else if (this.complianceLevel == JDK1_8) {
826+
buffer.append("\" -1.8");
824827
}
825828
buffer
826829
.append(" -preserveAllLocals -nowarn -g -classpath \"")

base/org.eclipse.jdt.groovy.core/src/org/eclipse/jdt/groovy/search/TypeInferencingVisitorWithRequestor.java

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -877,19 +877,13 @@ public void visitImports(ModuleNode node) {
877877
try {
878878
if (type != null) {
879879
visitClassReference(type);
880-
// FIXADE this is a bit messy, shoud use existing infra to push and pop
881880
completeExpressionStack.push(imp);
882881
if (imp.getFieldNameExpr() != null) {
883882
primaryTypeStack.push(type);
884883
imp.getFieldNameExpr().visit(this);
885884
dependentDeclarationStack.pop();
886885
dependentTypeStack.pop();
887886
}
888-
889-
// if (imp.getAliasExpr() != null) {
890-
// primaryTypeStack.push(type);
891-
// imp.getAliasExpr().visit(this);
892-
// }
893887
completeExpressionStack.pop();
894888
}
895889
} catch (VisitCompleted e) {
@@ -1001,9 +995,7 @@ public void visitBinaryExpression(BinaryExpression node) {
1001995

1002996
toVisitPrimary.visit(this);
1003997

1004-
ClassNode primaryExprType;
1005-
1006-
primaryExprType = primaryTypeStack.pop();
998+
ClassNode primaryExprType = primaryTypeStack.pop();
1007999
if (isAssignment) {
10081000
assignmentStorer.storeAssignment(node, scopes.peek(), primaryExprType);
10091001
}
@@ -1013,24 +1005,24 @@ public void visitBinaryExpression(BinaryExpression node) {
10131005
completeExpressionStack.pop();
10141006
// type of the entire expression
10151007
ClassNode completeExprType = primaryExprType;
1016-
10171008
ClassNode dependentExprType = primaryTypeStack.pop();
10181009

1019-
if (!isAssignment) {
1010+
// TODO: Is it an illegal state to have either as null?
1011+
assert primaryExprType != null && dependentExprType != null;
1012+
1013+
if (!isAssignment && primaryExprType != null && dependentExprType != null) {
10201014
// type of RHS of binary expression
10211015
// find the type of the complete expression
10221016
String associatedMethod = findBinaryOperatorName(node.getOperation().getText());
10231017
if (isArithmeticOperationOnNumberOrStringOrList(node.getOperation().getText(), primaryExprType, dependentExprType)) {
10241018
// another special case.
10251019
// In 1.8 and later, Groovy will not go through the
10261020
// MOP for standard arithmetic operations on numbers
1027-
completeExprType = dependentExprType.equals(VariableScope.STRING_CLASS_NODE) ? VariableScope.STRING_CLASS_NODE
1028-
: primaryExprType;
1021+
completeExprType = dependentExprType.equals(VariableScope.STRING_CLASS_NODE) ? VariableScope.STRING_CLASS_NODE : primaryExprType;
10291022
} else if (associatedMethod != null) {
10301023
// there is an overloadable method associated with this operation
10311024
// convert to a constant expression and infer type
1032-
TypeLookupResult result = lookupExpressionType(new ConstantExpression(associatedMethod), primaryExprType, false,
1033-
scopes.peek());
1025+
TypeLookupResult result = lookupExpressionType(new ConstantExpression(associatedMethod), primaryExprType, false, scopes.peek());
10341026
completeExprType = result.type;
10351027
if (associatedMethod.equals("getAt") && result.declaringType.equals(VariableScope.DGM_CLASS_NODE)) {
10361028
// special case getAt coming from DGM.
@@ -1069,13 +1061,8 @@ public void visitBinaryExpression(BinaryExpression node) {
10691061
}
10701062

10711063
/**
1072-
* Make assumption that no one has overloaded the basic arithmetic operations on numbers These operations will bypass the mop in
1073-
* most situations anyway
1074-
*
1075-
* @param text
1076-
* @param primaryExprType
1077-
* @param dependentExprType
1078-
* @return
1064+
* Make assumption that no one has overloaded the basic arithmetic operations on numbers.
1065+
* These operations will bypass the mop in most situations anyway.
10791066
*/
10801067
private boolean isArithmeticOperationOnNumberOrStringOrList(String text, ClassNode lhs, ClassNode rhs) {
10811068
if (text.length() != 1) {
@@ -2029,8 +2016,10 @@ private void handleCompleteExpression(Expression node, ClassNode exprType, Class
20292016

20302017
private void postVisit(Expression node, ClassNode type, ClassNode declaringType, ASTNode declaration) {
20312018
if (isPrimaryExpression(node)) {
2019+
assert type != null;
20322020
primaryTypeStack.push(type);
20332021
} else if (isDependentExpression(node)) {
2022+
// TODO: null has been seen here for type; is that okay?
20342023
dependentTypeStack.push(type);
20352024
dependentDeclarationStack.push(new Tuple(declaringType, declaration));
20362025
}
@@ -2180,7 +2169,7 @@ private MethodNode findMethodNode(IMethod method) {
21802169
try {
21812170
if (method.isConstructor()) {
21822171
List<ConstructorNode> constructors = clazz.getDeclaredConstructors();
2183-
if (constructors.size() == 0) {
2172+
if (constructors == null || constructors.isEmpty()) {
21842173
return null;
21852174
}
21862175
String[] jdtParamTypes = method.getParameterTypes() == null ? NO_PARAMS : method.getParameterTypes();
@@ -2415,8 +2404,8 @@ private boolean isPrimaryExpression(Expression node) {
24152404
TernaryExpression prop = (TernaryExpression) complete;
24162405
return prop.getTrueExpression() == node;
24172406
} else if (complete instanceof ForStatement) {
2418-
// this check is used to store the type of the collection expression so that it can be assigned to the for loop
2419-
// variable
2407+
// this check is used to store the type of the collection expression
2408+
// so that it can be assigned to the for loop variable
24202409
ForStatement prop = (ForStatement) complete;
24212410
return prop.getCollectionExpression() == node;
24222411
} else if (complete instanceof ListExpression) {
@@ -2460,8 +2449,8 @@ private boolean isPrimaryExpression(Expression node) {
24602449
* <li>property/field (ie- right part) of an attribute expression
24612450
* </ul>
24622451
*
2463-
* Note that for statements and ternary expressions do not have any dependent expression even though they have primary
2464-
* expressions
2452+
* Note that for statements and ternary expressions do not have any dependent
2453+
* expression even though they have primary expressions.
24652454
*
24662455
* @param node expression node to check
24672456
* @return true iff the node is the primary expression in an expression pair.

ide-test/org.codehaus.groovy.eclipse.codebrowsing.test/src/org/codehaus/groovy/eclipse/codebrowsing/tests/CodeSelectImportsTests.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ final class CodeSelectImportsTests extends BrowsingTestCase {
4848
void testCodeSelectOnImportType2() {
4949
String source = '''\
5050
import java.lang.Thread.State
51+
import java.util.regex.Pattern
5152
Pattern p = ~/123/
5253
'''.stripIndent()
5354

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
33
<classpathentry kind="src" path="src" output="bin"/>
4-
<classpathentry kind="src" path="test plugin" output="bin"/>
4+
<classpathentry kind="src" path="test plugin" output="bin">
5+
<attributes>
6+
<attribute name="ignore_optional_problems" value="true" />
7+
</attributes>
8+
</classpathentry>
59
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
610
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
711
</classpath>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
33
<classpathentry kind="src" path="src" output="bin"/>
4-
<classpathentry kind="src" path="src-ant" output="bin"/>
4+
<classpathentry kind="src" path="src-ant" output="bin-ant"/>
55
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
66
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
77
</classpath>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/bin
2+
/bin-ant

ide/org.codehaus.groovy.eclipse.ant/META-INF/MANIFEST.MF

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Bundle-SymbolicName: org.codehaus.groovy.eclipse.ant;singleton:=true
44
Bundle-Name: Groovy Ant support
55
Bundle-Vendor: Codehaus.org
66
Bundle-Version: 2.9.2.qualifier
7+
Bundle-ClassPath: .,
8+
groovyAntEclipse.jar
79
Require-Bundle: org.eclipse.core.runtime,
810
org.eclipse.ant.core,
911
org.apache.ant;bundle-version="1.7.0",
Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
1-
###############################################################################
2-
# Copyright (c) 2007, 2009 Codehaus.org, SpringSource, and others.
3-
# All rights reserved. This program and the accompanying materials
4-
# are made available under the terms of the Eclipse Public License v1.0
5-
# which accompanies this distribution, and is available at
6-
# http://www.eclipse.org/legal/epl-v10.html
7-
#
8-
# Contributors:
9-
# Andrew Eisenberg - modified for Groovy Eclipse 2.0
10-
###############################################################################
111
source.. = src/
122
output.. = bin/
13-
bin.includes = META-INF/,\
14-
.,\
15-
plugin.xml,\
3+
source.groovyAntEclipse.jar = src-ant/
4+
output.groovyAntEclipse.jar = bin-ant/
5+
6+
bin.includes = .,\
167
groovyAntEclipse.jar,\
8+
META-INF/,\
9+
plugin.xml,\
1710
about.html
18-
jars.compile.order = .,\
19-
groovyAntEclipse.jar
20-
source.groovyAntEclipse.jar = src-ant/
21-
output.groovyAntEclipse.jar = bin/
22-
compilerArg=-nowarn
2311
src.includes = about.html
24-
jars.extra.classpath=platform:/plugin/org.eclipse.jdt.core/jdtCompilerAdapter.jar
2512

13+
compilerArg=-nowarn
14+
jars.compile.order=.,groovyAntEclipse.jar
15+
jars.extra.classpath=platform:/plugin/org.eclipse.jdt.core/jdtCompilerAdapter.jar
-6.85 KB
Binary file not shown.

0 commit comments

Comments
 (0)