aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2004-03-16 09:21:31 +0000
committeraclement <aclement>2004-03-16 09:21:31 +0000
commit40de354443cd1d88cf533d10f77608d1b0cbfecf (patch)
treebf51cc04b3c18db1425794866b97fa988524080a /org.aspectj.ajdt.core
parent5c67166488df998bc208567c2fd27f21b52592c5 (diff)
downloadaspectj-40de354443cd1d88cf533d10f77608d1b0cbfecf.tar.gz
aspectj-40de354443cd1d88cf533d10f77608d1b0cbfecf.zip
Fix for Bugzilla Bug 41181
Support SerialVersionUID field if no new fields declared on class
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java18
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java12
2 files changed, 30 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
index 4d0e4cae4..ffc6333db 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
@@ -23,6 +23,7 @@ import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration;
//import org.aspectj.asm.internal.Relationship;
import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.*;
+import org.aspectj.weaver.bcel.LazyClassGen;
import org.aspectj.weaver.patterns.*;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
@@ -359,9 +360,26 @@ public class AjLookupEnvironment extends LookupEnvironment {
newI[n] = parentBinding;
}
sourceType.superInterfaces = newI;
+ warnOnAddedInterface(factory.fromEclipse(sourceType),parent);
}
}
+
+ public void warnOnAddedInterface (ResolvedTypeX type, ResolvedTypeX parent) {
+ World world = factory.getWorld();
+ ResolvedTypeX serializable = world.resolve(TypeX.SERIALIZABLE);
+ if (serializable.isAssignableFrom(type)
+ && !serializable.isAssignableFrom(parent)
+ && !LazyClassGen.hasSerialVersionUIDField(type)) {
+ world.getLint().needsSerialVersionUIDField.signal(
+ new String[] {
+ type.getName().toString(),
+ "added interface " + parent.getName().toString()
+ },
+ null,
+ null);
+ }
+ }
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
index aa2b13276..25e621ca1 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java
@@ -165,6 +165,18 @@ public class BcweaverJarMaker {
args.add("../tests/new/options11/injar/*.java");
CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
+
+ args = new ArrayList();
+
+ args.add("-classpath");
+ args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" +
+ File.pathSeparator + System.getProperty("aspectjrt.path"));
+ args.add("-outjar");
+ args.add("../tests/bugs/serialVersionUID/injar.jar");
+ args.add("../tests/bugs/serialVersionUID/Test.java");
+ args.add("../tests/bugs/serialVersionUID/Util.java");
+
+ CommandTestCase.runCompiler(args, CommandTestCase.NO_ERRORS);
}