summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2016-11-10 12:13:43 -0800
committerAndy Clement <aclement@pivotal.io>2016-11-10 12:13:43 -0800
commitf33db67c2e3d840b19896f4ec45dd1078eb412dc (patch)
tree1b8ba5d08ccba81eb362c44b4eba51012dbe4a37
parent611e04a9e1f3f2368f3ce3237b6288b119ac9943 (diff)
downloadaspectj-f33db67c2e3d840b19896f4ec45dd1078eb412dc.tar.gz
aspectj-f33db67c2e3d840b19896f4ec45dd1078eb412dc.zip
Fix 404345: another occurence of broken annotation building in JDT
-rw-r--r--org.eclipse.jdt.core/jdtcore-for-aspectj-src.zipbin5207300 -> 5207302 bytes
-rw-r--r--org.eclipse.jdt.core/jdtcore-for-aspectj.jarbin10253487 -> 10253519 bytes
-rw-r--r--tests/multiIncremental/pr404345/base/src/org/Constants.java5
-rw-r--r--tests/multiIncremental/pr404345/base/src/org/FetchProfile.java16
-rw-r--r--tests/multiIncremental/pr404345/base/src/org/FetchProfileName.java5
-rw-r--r--tests/multiIncremental/pr404345/base/src/org/FetchProfiles.java10
-rw-r--r--tests/multiIncremental/pr404345/base/src/org/package-info.java9
-rw-r--r--tests/multiIncremental/pr404345/inc1/src/org/Constants.java3
-rw-r--r--tests/multiIncremental/pr404345/inc1/src/org/FetchProfileName.java5
-rw-r--r--tests/multiIncremental/pr404345/inc2/src/org/package-info.java2
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java7
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java36
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java10
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java51
14 files changed, 107 insertions, 52 deletions
diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
index 29a5eb821..76d1be79c 100644
--- a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
+++ b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar
index 6aa41c4c1..3ef06f537 100644
--- a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar
+++ b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar
Binary files differ
diff --git a/tests/multiIncremental/pr404345/base/src/org/Constants.java b/tests/multiIncremental/pr404345/base/src/org/Constants.java
new file mode 100644
index 000000000..c09fdf3db
--- /dev/null
+++ b/tests/multiIncremental/pr404345/base/src/org/Constants.java
@@ -0,0 +1,5 @@
+package org;
+
+public class Constants {
+ public static final String MISSING="missing";
+}
diff --git a/tests/multiIncremental/pr404345/base/src/org/FetchProfile.java b/tests/multiIncremental/pr404345/base/src/org/FetchProfile.java
new file mode 100644
index 000000000..5ad345d35
--- /dev/null
+++ b/tests/multiIncremental/pr404345/base/src/org/FetchProfile.java
@@ -0,0 +1,16 @@
+package org;
+
+public @interface FetchProfile {
+ String name();
+ FetchProfile.FetchOverride[] fetchOverrides();
+
+ @interface FetchOverride {
+ Class<?> entity();
+ String association() default "";
+ }
+}
+
+//@FetchProfiles({
+//@FetchProfile(name = FetchProfileName.LOCATION, fetchOverrides = {
+// @FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_SYSTEMSTATE),
+// @FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_KEYVAULT) }),
diff --git a/tests/multiIncremental/pr404345/base/src/org/FetchProfileName.java b/tests/multiIncremental/pr404345/base/src/org/FetchProfileName.java
new file mode 100644
index 000000000..b7d9af0c7
--- /dev/null
+++ b/tests/multiIncremental/pr404345/base/src/org/FetchProfileName.java
@@ -0,0 +1,5 @@
+package org;
+
+public class FetchProfileName {
+ public static final String LOCATION="missing";
+}
diff --git a/tests/multiIncremental/pr404345/base/src/org/FetchProfiles.java b/tests/multiIncremental/pr404345/base/src/org/FetchProfiles.java
new file mode 100644
index 000000000..bba90b09c
--- /dev/null
+++ b/tests/multiIncremental/pr404345/base/src/org/FetchProfiles.java
@@ -0,0 +1,10 @@
+package org;
+
+public @interface FetchProfiles {
+ FetchProfile[] value();
+}
+
+//@FetchProfiles({
+//@FetchProfile(name = FetchProfileName.LOCATION, fetchOverrides = {
+// @FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_SYSTEMSTATE),
+// @FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_KEYVAULT) }), \ No newline at end of file
diff --git a/tests/multiIncremental/pr404345/base/src/org/package-info.java b/tests/multiIncremental/pr404345/base/src/org/package-info.java
new file mode 100644
index 000000000..c1e4ee1b8
--- /dev/null
+++ b/tests/multiIncremental/pr404345/base/src/org/package-info.java
@@ -0,0 +1,9 @@
+//@FetchProfiles({
+ @FetchProfile(name = FetchProfileName.LOCATION, fetchOverrides = {
+// @FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_SYSTEMSTATE),
+ @FetchProfile.FetchOverride(entity = Location.class, association = Location.PROPERTY_KEYVAULT)
+})
+//})
+package org;
+
+
diff --git a/tests/multiIncremental/pr404345/inc1/src/org/Constants.java b/tests/multiIncremental/pr404345/inc1/src/org/Constants.java
new file mode 100644
index 000000000..851d68292
--- /dev/null
+++ b/tests/multiIncremental/pr404345/inc1/src/org/Constants.java
@@ -0,0 +1,3 @@
+package org;
+class Constants {
+}
diff --git a/tests/multiIncremental/pr404345/inc1/src/org/FetchProfileName.java b/tests/multiIncremental/pr404345/inc1/src/org/FetchProfileName.java
new file mode 100644
index 000000000..b7d9af0c7
--- /dev/null
+++ b/tests/multiIncremental/pr404345/inc1/src/org/FetchProfileName.java
@@ -0,0 +1,5 @@
+package org;
+
+public class FetchProfileName {
+ public static final String LOCATION="missing";
+}
diff --git a/tests/multiIncremental/pr404345/inc2/src/org/package-info.java b/tests/multiIncremental/pr404345/inc2/src/org/package-info.java
new file mode 100644
index 000000000..9ffa9f10f
--- /dev/null
+++ b/tests/multiIncremental/pr404345/inc2/src/org/package-info.java
@@ -0,0 +1,2 @@
+@Foo(Constants.MISSING)
+package org;
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
index 9b6c11e90..cfe4495a4 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
@@ -335,9 +335,8 @@ public class AjdeInteractionTestbed extends TestCase {
MultiProjTestMessageHandler handler = (MultiProjTestMessageHandler) compiler.getMessageHandler();
if (handler.hasErrorMessages()) {
System.err.println("Build errors:");
- for (Iterator<IMessage> iter = handler.getErrorMessages().iterator(); iter.hasNext();) {
- IMessage element = iter.next();
- System.err.println(element);
+ for (IMessage message: handler.getErrorMessages()) {
+ System.err.println(message);
}
System.err.println("---------");
}
@@ -358,7 +357,7 @@ public class AjdeInteractionTestbed extends TestCase {
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getWeavingMessages();
}
- public List<IMessage> getCompilerErrorMessages(String projectName) {
+ public List<String> getCompilerErrorMessages(String projectName) {
AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
return ((MultiProjTestMessageHandler) compiler.getMessageHandler()).getCompilerErrors();
}
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java
index 562291c69..86302bfba 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestCompilerConfiguration.java
@@ -13,7 +13,6 @@ package org.aspectj.systemtest.incremental.tools;
import java.io.File;
import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -30,11 +29,11 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
private boolean verbose = false;
private String classPath = "";
- private Set aspectPath = null;
- private Map sourcePathResources = null;
+ private Set<File> aspectPath = null;
+ private Map<String,File> sourcePathResources = null;
private IOutputLocationManager outputLocationManager = null;
private List<String> dependants;
- private Map javaOptionsMap;
+ private Map<String,String> javaOptionsMap;
private Set<File> inpath;
private String encoding = null;
private String outjar;
@@ -43,8 +42,8 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
private String nonstandardoptions;
private List<File> modifiedFiles;
private List<String> modifiedDirs;
- private List<String> projectSourceFiles = new ArrayList();
- private List xmlConfigFiles = new ArrayList();
+ private List<String> projectSourceFiles = new ArrayList<>();
+ private List<String> xmlConfigFiles = new ArrayList<>();
private String projectPath;
int changed;
@@ -53,7 +52,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
this.projectPath = projectPath;
}
- public Set getAspectPath() {
+ public Set<File> getAspectPath() {
log("ICompilerConfiguration.getAspectPath(" + aspectPath + ")");
return aspectPath;
}
@@ -62,9 +61,8 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
log("ICompilerConfiguration.getClasspath()");
// AJDT has all the output directories on it's classpath
StringBuffer sb = new StringBuffer();
- List allOutputPaths = getOutputLocationManager().getAllOutputLocations();
- for (Iterator iterator = allOutputPaths.iterator(); iterator.hasNext();) {
- File dir = (File) iterator.next();
+ List<File> allOutputPaths = getOutputLocationManager().getAllOutputLocations();
+ for (File dir: allOutputPaths) {
sb.append(File.pathSeparator + dir.getAbsolutePath());
}
String cp = sb.toString() + File.pathSeparator + new File(AjdeInteractionTestbed.testdataSrcDir) + File.pathSeparator
@@ -77,8 +75,8 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
// look at dependant projects
if (dependants != null) {
- for (Iterator iter = dependants.iterator(); iter.hasNext();) {
- cp = AjdeInteractionTestbed.getFile((String) iter.next(), "bin") + File.pathSeparator + cp;
+ for (String dependant: dependants) {
+ cp = AjdeInteractionTestbed.getFile(dependant, "bin") + File.pathSeparator + cp;
}
}
// System.err.println("For project "+projectPath+" getClasspath() returning "+cp);
@@ -120,12 +118,12 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
return outputLocationManager;
}
- public List getProjectSourceFiles() {
+ public List<String> getProjectSourceFiles() {
log("ICompilerConfiguration.getProjectSourceFiles()");
return projectSourceFiles;
}
- public List getProjectXmlConfigFiles() {
+ public List<String> getProjectXmlConfigFiles() {
return xmlConfigFiles;
}
@@ -134,7 +132,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
return modifiedFiles;
}
- public Map getSourcePathResources() {
+ public Map<String,File> getSourcePathResources() {
log("ICompilerConfiguration.getSourcePathResources()");
return sourcePathResources;
}
@@ -152,7 +150,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
}
// -------------------- setter methods useful for testing ---------------
- public void setAspectPath(Set aspectPath) {
+ public void setAspectPath(Set<File> aspectPath) {
this.aspectPath = aspectPath;
this.changed |= ICompilerConfiguration.ASPECTPATH_CHANGED;
}
@@ -177,7 +175,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
this.changed |= ICompilerConfiguration.PROCESSOR_CHANGED;
}
- public void setJavaOptions(Map javaOptions) {
+ public void setJavaOptions(Map<String,String> javaOptions) {
this.javaOptionsMap = javaOptions;
this.changed |= ICompilerConfiguration.JAVAOPTIONS_CHANGED;
}
@@ -215,7 +213,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
}
}
- public void setSourcePathResources(Map sourcePathResources) {
+ public void setSourcePathResources(Map<String,File> sourcePathResources) {
this.sourcePathResources = sourcePathResources;
this.changed |= ICompilerConfiguration.PROJECTSOURCERESOURCES_CHANGED;
}
@@ -240,7 +238,7 @@ public class MultiProjTestCompilerConfiguration implements ICompilerConfiguratio
modifiedDirs = null;
}
- public List getClasspathElementsWithModifiedContents() {
+ public List<String> getClasspathElementsWithModifiedContents() {
return modifiedDirs;
}
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java
index 26afbf882..fa66bede7 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjTestMessageHandler.java
@@ -32,15 +32,15 @@ public class MultiProjTestMessageHandler implements IBuildMessageHandler {
private List<IMessage> errorMessages;
private List<IMessage> warningMessages;
private List<IMessage> weavingMessages;
- private List compilerErrors;
- private List ignoring;
+ private List<String> compilerErrors;
+ private List<Kind> ignoring;
public MultiProjTestMessageHandler() {
- ignoring = new ArrayList();
+ ignoring = new ArrayList<>();
errorMessages = new ArrayList<IMessage>();
warningMessages = new ArrayList<IMessage>();
weavingMessages = new ArrayList<IMessage>();
- compilerErrors = new ArrayList();
+ compilerErrors = new ArrayList<>();
ignore(IMessage.INFO);
ignore(IMessage.WEAVEINFO);
}
@@ -112,7 +112,7 @@ public class MultiProjTestMessageHandler implements IBuildMessageHandler {
return weavingMessages;
}
- public List<IMessage> getCompilerErrors() {
+ public List<String> getCompilerErrors() {
return compilerErrors;
}
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index 7080c03c9..36001fe6a 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -14,8 +14,6 @@ package org.aspectj.systemtest.incremental.tools;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
-import java.net.URL;
-import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -101,7 +99,16 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
runMethod(p, "demo.ConverterTest", "run");
}
-
+ public void testRogueConstantReference() throws Exception {
+ String p = "pr404345";
+ initialiseProject(p);
+ setProjectEncoding(p, "UTF-8");
+ build(p);
+ checkWasFullBuild();
+ // Should both indicate that Location cannot be resolved
+ assertEquals(2,getErrorMessages(p).size());
+ }
+
public void testIncrementalITDInners4() throws Exception {
String p = "prInner4";
initialiseProject(p);
@@ -1150,7 +1157,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
alter(p, "inc1");
build(p);
checkWasntFullBuild();
- List l = getCompilerErrorMessages(p);
+ List<String> l = getCompilerErrorMessages(p);
assertEquals("Unexpected compiler error", 0, l.size());
}
@@ -1159,14 +1166,14 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
String p = "pr298504";
initialiseProject(p);
build(p);
- List l = getErrorMessages(p);
+ List<IMessage> l = getErrorMessages(p);
assertTrue(l.toString().indexOf("ManagedResource cannot be resolved to a type") != -1);
// checkWasFullBuild();
alter(p, "inc1");
build(p);
// checkWasntFullBuild();
- l = getCompilerErrorMessages(p);
- assertTrue(l.toString().indexOf("NullPointerException") == -1);
+ List<String> compilerErrors = getCompilerErrorMessages(p);
+ assertTrue(compilerErrors.toString().indexOf("NullPointerException") == -1);
l = getErrorMessages(p);
assertTrue(l.toString().indexOf("ManagedResource cannot be resolved to a type") != -1);
}
@@ -1210,7 +1217,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
// "src/q/Asp.java"));
build(p);
checkWasntFullBuild();
- List<IMessage> l = getCompilerErrorMessages(p);
+ List<String> l = getCompilerErrorMessages(p);
assertEquals("Unexpected compiler error", 0, l.size());
}
@@ -1245,7 +1252,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
alter(p, "inc1");
build(p);
checkWasntFullBuild();
- List<IMessage> l = getCompilerErrorMessages(p);
+ List<String> l = getCompilerErrorMessages(p);
assertEquals("Unexpected compiler error", 0, l.size());
}
@@ -1263,7 +1270,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
checkWasFullBuild();
alter(p, "inc1");
build(p);
- List<IMessage> l = getCompilerErrorMessages(p);
+ List<String> l = getCompilerErrorMessages(p);
assertEquals("Unexpected compiler error", 0, l.size());
}
@@ -1909,7 +1916,6 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
+ "ms second=" + timeTakenForSimpleIncBuild + "ms", timeTakenForSimpleIncBuild < timeTakenForFullBuildAndWeave);
}
- @SuppressWarnings("rawtypes")
public void testBuildingTwoProjectsInTurns() {
initialiseProject("P1");
initialiseProject("P2");
@@ -2114,7 +2120,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
long stime = System.currentTimeMillis();
try {
ZipFile zf = new ZipFile("c:/jvms/jdk1.6.0_06/jre/lib/rt.jar");
- Enumeration e = zf.entries();
+ Enumeration<? extends ZipEntry> e = zf.entries();
while (e.hasMoreElements()) {
ZipEntry ze = (ZipEntry) e.nextElement();
String n = ze.getName();
@@ -3052,12 +3058,11 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
getWarningMessages("PR133117").size() == 1);
alter("PR133117", "inc1");
build("PR133117");
- List warnings = getWarningMessages("PR133117");
- List noGuardWarnings = new ArrayList();
- for (Iterator iter = warnings.iterator(); iter.hasNext();) {
- IMessage element = (IMessage) iter.next();
- if (element.getMessage().indexOf("Xlint:noGuardForLazyTjp") != -1) {
- noGuardWarnings.add(element);
+ List<IMessage> warnings = getWarningMessages("PR133117");
+ List<IMessage> noGuardWarnings = new ArrayList<>();
+ for (IMessage warning: warnings) {
+ if (warning.getMessage().indexOf("Xlint:noGuardForLazyTjp") != -1) {
+ noGuardWarnings.add(warning);
}
}
assertTrue("There should only be two Xlint:noGuardForLazyTjp warning message reported:\n" + noGuardWarnings,
@@ -3687,7 +3692,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
configureJavaOptionsMap("PR164384", javaOptions);
build("PR164384");
- List errors = getErrorMessages("PR164384");
+ List<IMessage> errors = getErrorMessages("PR164384");
if (getCompilerForProjectWithName("PR164384").isJava6Compatible()) {
assertTrue("There should be no errros:\n" + errors, errors.isEmpty());
@@ -3957,9 +3962,8 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
return ipe;
}
}
- List kids = ipe.getChildren();
- for (Iterator iter = kids.iterator(); iter.hasNext();) {
- IProgramElement kid = (IProgramElement) iter.next();
+ List<IProgramElement> kids = ipe.getChildren();
+ for (IProgramElement kid: kids) {
IProgramElement found = findAdvice(kid, whichOne);
if (found != null) {
return found;
@@ -3986,8 +3990,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
}
}
List<IProgramElement> kids = ipe.getChildren();
- for (Iterator iter = kids.iterator(); iter.hasNext();) {
- IProgramElement kid = (IProgramElement) iter.next();
+ for (IProgramElement kid: kids) {
IProgramElement found = findCode(kid, linenumber);
if (found != null) {
return found;