diff options
author | aclement <aclement> | 2004-12-10 13:34:42 +0000 |
---|---|---|
committer | aclement <aclement> | 2004-12-10 13:34:42 +0000 |
commit | b1111a9826f2734fd770183138bc0d74fad40579 (patch) | |
tree | 4375c5a9634a14196e41727cd570dffd6bcca598 /org.aspectj.ajdt.core | |
parent | f196b3c3ffead3f78403329bf8792f3b24cf18bb (diff) | |
download | aspectj-b1111a9826f2734fd770183138bc0d74fad40579.tar.gz aspectj-b1111a9826f2734fd770183138bc0d74fad40579.zip |
Autoboxing and decp restrictions
Diffstat (limited to 'org.aspectj.ajdt.core')
8 files changed, 52 insertions, 1 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java index f3aad9214..e383fb458 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java @@ -612,6 +612,21 @@ public class BuildArgParser extends Main { buildConfig.setProceedOnError(true); } else if (new File(arg).isDirectory()) { showError("dir arg not permitted: " + arg); + } else if (arg.equals("-1.5")) { + buildConfig.setBehaveInJava5Way(true); +// this would enable the '-source 1.5' to do the same as '-1.5' but doesnt sound quite right as +// as an option right now as it doesnt mean we support 1.5 source code - people will get confused... +// } else if (arg.equals("-source")) { +// if (args.size() > nextArgIndex) { +// String level = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue(); +// if (!level.equals("1.5")) { +// unparsedArgs.add("-source"); +// unparsedArgs.add(level); +// } else { +// buildConfig.setJava5Behaviour(true); +// } +// args.remove(args.get(nextArgIndex)); +// } } else { // argfile, @file parsed by superclass // no eclipse options parsed: diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties index 0dd92150a..061417143 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties @@ -55,6 +55,7 @@ Standard Eclipse compiler options:\n\ \ Compliance options:\n\ \ -1.3 use 1.3 compliance level (implicit -source 1.3 -target 1.1)\n\ \ -1.4 + use 1.4 compliance level (implicit -source 1.3 -target 1.2)\n\ +\ -1.5 set behaviour of the weaver to 1.5 mode\n\ \ -source <version> set source level (1.3 or 1.4)\n\ \ -target <version> set classfile target (1.1 to 1.4)\n\ \ \n\ 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 da778a54e..8306dd120 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 @@ -416,7 +416,7 @@ public class AjLookupEnvironment extends LookupEnvironment { } private void doDeclareParents(DeclareParents declareParents, SourceTypeBinding sourceType) { - List newParents = declareParents.findMatchingNewParents(factory.fromEclipse(sourceType)); + List newParents = declareParents.findMatchingNewParents(factory.fromEclipse(sourceType),false); if (!newParents.isEmpty()) { for (Iterator i = newParents.iterator(); i.hasNext(); ) { ResolvedTypeX parent = (ResolvedTypeX)i.next(); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java index 562a5951b..12ca5f606 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java @@ -524,4 +524,12 @@ public class AjBuildConfig { public boolean getProceedOnError() { return options.proceedOnError; } + + public void setBehaveInJava5Way(boolean b) { + options.behaveInJava5Way = b; + } + + public boolean getBehaveInJava5Way() { + return options.behaveInJava5Way; + } } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index a08d1c0ef..d0701d190 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -489,6 +489,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc List cp = buildConfig.getBootclasspath(); cp.addAll(buildConfig.getClasspath()); bcelWorld = new BcelWorld(cp, handler, null); + bcelWorld.setBehaveInJava5Way(buildConfig.getBehaveInJava5Way()); bcelWorld.setXnoInline(buildConfig.isXnoInline()); bcelWorld.setXlazyTjp(buildConfig.isXlazyTjp()); bcelWeaver = new BcelWeaver(bcelWorld); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java index 904954721..8553ed9df 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java @@ -66,6 +66,9 @@ public class AjCompilerOptions extends CompilerOptions { public boolean xReweavableCompress = false; public boolean showWeavingInformation = false; + // If true - autoboxing behaves differently ... + public boolean behaveInJava5Way = false; + // these next three not exposed by IDEs public boolean generateModel = false; public boolean generateJavaDocsInModel = false; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java index a1e066b79..b91aed439 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AspectJBuilder.java @@ -154,6 +154,7 @@ public class AspectJBuilder extends JavaBuilder implements ICompilerAdapterFacto private void initWorldAndWeaver(AjCompilerOptions options) { cpManager = new EclipseClassPathManager(nameEnvironment); myBcelWorld = new BcelWorld(cpManager,new UnhandledMessageHandler(getProject()),null /*(xrefHandler)*/); + myBcelWorld.setBehaveInJava5Way(options.behaveInJava5Way); myBcelWorld.setXnoInline(options.xNoInline); myBcelWorld.setXlazyTjp(options.xLazyThisJoinPoint); setLintProperties(myBcelWorld,options); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java index 238879e71..a020afe9f 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java @@ -422,6 +422,28 @@ public class BuildArgParserTestCase extends TestCase { assertTrue(new File(lintFile).exists()); assertEquals(getCanonicalPath(new File(lintFile)),config.getLintSpecFile().getAbsolutePath()); } + + /** + * The option '-1.5' are currently eaten by the AspectJ argument parser - since + * the JDT compiler upon which we are based doesn't understand them - *this should change* when we + * switch to a 1.5 compiler base. They are currently used to determine whether the weaver should + * behave in a '1.5' way - for example autoboxing behaves differently when the 1.5 flag is specified. + * Under 1.4 Integer != int + * Under 1.5 Integer == int + * (this applies to all primitive types) + */ + public void testSource15() throws InvalidInputException { +// AjBuildConfig config = genBuildConfig(new String[]{"-source","1.5"},messageWriter); +// assertTrue("should be in 1.5 mode",config.getJave5Behaviour()); + AjBuildConfig config = genBuildConfig(new String[]{"-1.5"},messageWriter); + assertTrue("should be in 1.5 mode",config.getBehaveInJava5Way()); + config = genBuildConfig(new String[]{"-source","1.4"},messageWriter); + assertTrue("should not be in 1.5 mode",!config.getBehaveInJava5Way()); + assertTrue("should be in 1.4 mode",config.getOptions().sourceLevel == CompilerOptions.JDK1_4); + config = genBuildConfig(new String[]{"-source","1.3"},messageWriter); + assertTrue("should not be in 1.5 mode",!config.getBehaveInJava5Way()); + assertTrue("should be in 1.3 mode",config.getOptions().sourceLevel == CompilerOptions.JDK1_3); + } public void testOptions() throws InvalidInputException { // AjdtCommand command = new AjdtCommand(); |