Browse Source

move to Eclipse 3.0 M6 JDT core (v_396). Also makes 1.4 the

default mode (inherited behaviour from JDT).
tags/v_preCompileLoopAlteration
acolyer 20 years ago
parent
commit
19ed0a21b8
89 changed files with 1991 additions and 1767 deletions
  1. 7
    6
      ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
  2. 2
    1
      ajde/testdata/LstBuildConfigManagerTest/bad-injar.lst
  3. 3
    3
      ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java
  4. 2
    2
      ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
  5. 5
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java
  6. 36
    17
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
  7. 107
    57
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties
  8. 20
    9
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java
  9. 55
    40
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
  10. 61
    60
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
  11. 16
    7
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java
  12. 9
    7
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java
  13. 2
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterSuperFixerVisitor.java
  14. 2
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java
  15. 1
    1
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/KnownFieldReference.java
  16. 23
    15
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/MakeDeclsPublicVisitor.java
  17. 12
    21
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java
  18. 10
    8
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java
  19. 2
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ProceedVisitor.java
  20. 10
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PseudoToken.java
  21. 12
    5
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PseudoTokens.java
  22. 6
    6
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java
  23. 3
    3
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java
  24. 3
    3
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
  25. 3
    3
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
  26. 2
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InlineAccessFieldBinding.java
  27. 5
    3
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java
  28. 2
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java
  29. 5
    5
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java
  30. 978
    1289
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java
  31. 6
    7
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjScanner.java
  32. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser1.rsc
  33. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser10.rsc
  34. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser11.rsc
  35. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser12.rsc
  36. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser13.rsc
  37. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser14.rsc
  38. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser15.rsc
  39. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser16.rsc
  40. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser17.rsc
  41. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser18.rsc
  42. 1
    0
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser19.rsc
  43. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser2.rsc
  44. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser20.rsc
  45. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser3.rsc
  46. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser4.rsc
  47. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser5.rsc
  48. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser6.rsc
  49. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser7.rsc
  50. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser8.rsc
  51. BIN
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser9.rsc
  52. 202
    0
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/readableNames.properties
  53. 2
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java
  54. 18
    6
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java
  55. 1
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
  56. 13
    2
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java
  57. 1
    1
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java
  58. 8
    15
      org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java
  59. 2
    5
      org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java
  60. 40
    11
      org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java
  61. 42
    36
      org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
  62. 2
    2
      org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java
  63. 2
    2
      org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AsmBuilderTest.java
  64. BIN
      org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
  65. BIN
      org.eclipse.jdt.core/jdtcore-for-aspectj.jar
  66. 1
    1
      taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
  67. 79
    35
      tests/ajcTests.xml
  68. 8
    0
      tests/bugs/ParserRecoveryTest.java
  69. 9
    0
      tests/bugs/ParserRecoveryTestPureJava.java
  70. 3
    2
      tests/errors/BadIntroduction.java
  71. 2
    4
      tests/errors/BadIntroductionDesignator.java
  72. 1
    3
      tests/errors/ExtraClosingBrace.java
  73. 3
    4
      tests/errors/NoAspect.java
  74. 1
    3
      tests/errors/NoSource.java
  75. 2
    1
      tests/errors/TopLevelAfter.java
  76. 3
    2
      tests/errors/TopLevelAround.java
  77. 2
    2
      tests/errors/TopLevelBefore.java
  78. 6
    7
      tests/errors/WildcardForReturns.java
  79. 13
    5
      tests/new/AroundChangeThis.java
  80. 3
    3
      tests/new/AroundInnerCalls.java
  81. 56
    0
      tests/new/AroundInnerCalls13.java
  82. 1
    2
      tests/new/DeclareMethodCE.java
  83. 1
    1
      tests/new/InterfaceConstructor.java
  84. 3
    3
      tests/new/RecognizeAspectCE.java
  85. 13
    0
      tests/new/perThis/p/EachObjectTarget.java
  86. 11
    0
      tests/new/perThis/the/deep/pkg/EachObjectInDeepPackage.java
  87. 0
    13
      tests/options/WarnDeprecated.java
  88. 8
    0
      tests/options/deprecated/OldStuff.java
  89. 18
    0
      tests/options/deprecated/WarnDeprecated.java

+ 7
- 6
ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java View File

@@ -149,9 +149,9 @@ public class CompilerAdapter {
String[] args = new String[] { "@" + configFile.getAbsolutePath() };
CountingMessageHandler handler
= CountingMessageHandler.makeCountingMessageHandler(messageHandler);
BuildArgParser parser = new BuildArgParser();
BuildArgParser parser = new BuildArgParser(handler);
AjBuildConfig config = parser.genBuildConfig(args, handler, false, configFile);
AjBuildConfig config = parser.genBuildConfig(args, false, configFile);
configureProjectOptions(config, Ajde.getDefault().getProjectProperties()); // !!! not what the API intended

// -- get globals, treat as defaults used if no local values
@@ -312,10 +312,11 @@ public class CompilerAdapter {
if (lineNo) javaOptions.put(CompilerOptions.OPTION_LineNumberAttribute,
CompilerOptions.GENERATE);
}
if ( options.getNoImportError() ) {
javaOptions.put( CompilerOptions.OPTION_ReportInvalidImport,
CompilerOptions.WARNING);
}
//XXX we can't turn off import errors in 3.0 stream
// if ( options.getNoImportError() ) {
// javaOptions.put( CompilerOptions.OPTION_ReportInvalidImport,
// CompilerOptions.WARNING);
// }
if ( options.getPreserveAllLocals() ) {
javaOptions.put( CompilerOptions.OPTION_PreserveUnusedLocal,

+ 2
- 1
ajde/testdata/LstBuildConfigManagerTest/bad-injar.lst View File

@@ -1 +1,2 @@
-injars foo.jar
-inpath
foo.jar

+ 3
- 3
ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java View File

@@ -350,9 +350,9 @@ public class BuildConfigurationTests extends AjdeTestCase {
buildConfig = compilerAdapter.genBuildConfig( configFile );
assertTrue(configFile + " failed", null != buildConfig);
Map options = buildConfig.getJavaOptions();
String noImport = (String) options.get( CompilerOptions.OPTION_ReportInvalidImport );
assertEquals( "no import", CompilerOptions.WARNING, noImport );
buildOptions.setNoImportError( false );
// String noImport = (String) options.get( CompilerOptions.OPTION_ReportInvalidImport );
// assertEquals( "no import", CompilerOptions.WARNING, noImport );
// buildOptions.setNoImportError( false );
}
public void testPreserveAllLocals() {

+ 2
- 2
ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java View File

@@ -54,7 +54,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
doSynchronousBuild("bad-injar.lst");
messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
assertTrue(message.getContainedMessage().getMessage().indexOf("invalid") != -1);
assertTrue(message.getContainedMessage().getMessage().indexOf("bad inpath") != -1);
}

public void testErrorMessages() throws IOException {
@@ -63,7 +63,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
SourceLineTask message = (SourceLineTask)messages.get(0);
assertEquals("invalid option: aaa.bbb", message.getContainedMessage().getMessage());
assertTrue(message.getContainedMessage().getMessage(), message.getContainedMessage().getMessage().indexOf("aaa.bbb") != -1);
}


+ 5
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/AjdtCommand.java View File

@@ -87,6 +87,9 @@ public class AjdtCommand implements ICommand {
}
// regenerate configuration b/c world might have changed (?)
AjBuildConfig config = genBuildConfig(savedArgs, counter);
if (!config.shouldProceed()) {
return true;
}
if (!config.hasSources()) {
MessageUtil.error(counter, "no sources specified");
}
@@ -127,8 +130,8 @@ public class AjdtCommand implements ICommand {
* a source location context for locating the error.
*/
public static AjBuildConfig genBuildConfig(String[] args, CountingMessageHandler handler) {
BuildArgParser parser = new BuildArgParser();
AjBuildConfig config = parser.genBuildConfig(args, handler);
BuildArgParser parser = new BuildArgParser(handler);
AjBuildConfig config = parser.genBuildConfig(args);

ISourceLocation location = null;
if (config.getConfigFile() != null) {

+ 36
- 17
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java View File

@@ -29,6 +29,13 @@ public class BuildArgParser extends Main {
private static final String BUNDLE_NAME = "org.aspectj.ajdt.ajc.messages";
private static boolean LOADED_BUNDLE = false;
static {
bundle = ResourceBundle.getBundle(BUNDLE_NAME);
if (!LOADED_BUNDLE) {
LOADED_BUNDLE = true;
}
}
/** to initialize super's PrintWriter but refer to underlying StringWriter */
private static class StringPrintWriter extends PrintWriter {
public final StringWriter stringWriter;
@@ -39,11 +46,8 @@ public class BuildArgParser extends Main {
}

/** @return multi-line String usage for the compiler */
public static String getUsage() {
if (!LOADED_BUNDLE) { // get eclipse usage unless bundle loaded...
new BuildArgParser();
}
return Main.bind("misc.usage", Main.bind("compiler.version"));
public static String getUsage() {
return Main.bind("misc.usage");
}
/**
@@ -55,50 +59,48 @@ public class BuildArgParser extends Main {
*/
private final StringBuffer errorSink;
private IMessageHandler handler;
/**
* Overrides super's bundle.
*/
public BuildArgParser(PrintWriter writer) {
public BuildArgParser(PrintWriter writer, IMessageHandler handler) {
super(writer, writer, false);
bundle = ResourceBundle.getBundle(BUNDLE_NAME);
if (!LOADED_BUNDLE) {
LOADED_BUNDLE = true;
}

if (writer instanceof StringPrintWriter) {
errorSink = ((StringPrintWriter) writer).stringWriter.getBuffer();
} else {
errorSink = null;
}
this.handler = handler;
}

/** Set up to capture messages using getOtherMessages(boolean) */
public BuildArgParser() {
this(new StringPrintWriter(new StringWriter()));
public BuildArgParser(IMessageHandler handler) {
this(new StringPrintWriter(new StringWriter()),handler);
}

/**
* Generate build configuration for the input args,
* passing to handler any error messages.
* @param args the String[] arguments for the build configuration
* @param handler the IMessageHandler handler for any errors
* @return AjBuildConfig per args,
* which will be invalid unless there are no handler errors.
*/
public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler) {
return genBuildConfig(args, handler, true, null);
public AjBuildConfig genBuildConfig(String[] args) {
return genBuildConfig(args, true, null);
}
/**
* Generate build configuration for the input args,
* passing to handler any error messages.
* @param args the String[] arguments for the build configuration
* @param handler the IMessageHandler handler for any errors
* @param setClasspath determines if the classpath should be parsed and set on the build configuration
* @param configFile can be null
* @return AjBuildConfig per args,
* which will be invalid unless there are no handler errors.
*/
public AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler, boolean setClasspath, File configFile) {
public AjBuildConfig genBuildConfig(String[] args, boolean setClasspath, File configFile) {
AjBuildConfig buildConfig = new AjBuildConfig();
buildConfig.setConfigFile(configFile);
try {
@@ -135,6 +137,11 @@ public class BuildArgParser extends Main {
javaArgList.addAll(parser.getUnparsedArgs());
super.configure((String[])javaArgList.toArray(new String[javaArgList.size()]));
if (!proceed) {
buildConfig.doNotProceed();
return buildConfig;
}
if (buildConfig.getSourceRoots() != null) {
for (Iterator i = buildConfig.getSourceRoots().iterator(); i.hasNext(); ) {
fileList.addAll(collectSourceRootFiles((File)i.next()));
@@ -168,6 +175,18 @@ public class BuildArgParser extends Main {
return buildConfig;
}


// from super...
public void printVersion() {
System.err.println("AspectJ Compiler " + Version.text + " built on " + Version.time_text); //$NON-NLS-1$
System.err.flush();
}
public void printUsage() {
System.out.println(bind("misc.usage")); //$NON-NLS-1$
System.out.flush();
}

/**
* Get messages not dumped to handler or any PrintWriter.
* @param flush if true, empty errors

+ 107
- 57
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties View File

@@ -4,11 +4,15 @@
The -Xlintfile:lint.properties allows fine-grained control. In tools.jar, see
org/aspectj/weaver/XlintDefault.properties for the default behavior and a template to copy.
### AspectJ-specific messages
configure.version = AspectJ Compiler 1.1
compiler.name = AspectJ Compiler

## this next one superceded by above...
## configure.version = AspectJ Compiler 1.1

configure.directoryNotExist = invalid option: {0}
## 3456789012345678901234567890123456789012345678901234567890123456789012345
### miscellaneous
misc.usage = AspectJ Compiler 1.1\n\
misc.usage = {compiler.name}\n\
\n\
\tUsage: <options> <source file | @argfile>..\n\
\n\
@@ -33,61 +37,103 @@ AspectJ-specific options:\n\
\t (cf org/aspectj/weaver/XlintDefault.properties)\n\
\n\
Standard Eclipse compiler options:\n\
\t-help emit this help message and quit\n\
\t-version emit compiler version number and quit\n\
\t-classpath <list> directories and zip files for the classpath\n\
\t (<list> uses platform-specific path delimiter)\n\
\t-bootclasspath <list> override bootclasspath for finding compile types\n\
\t (<list> uses platform-specific path delimiter)\n\
\t-extdirs <list> override extension dirs for finding compile types\n\
\t (<list> uses platform-specific path delimiter)\n\
\t-d <dir> destination directory for output classes \n\
\t-target <ver> classfile setting (1.1 or 1.2, default is 1.1)\n\
\t-1.3 set compliance level to 1.3 (default)\n\
\t-1.4 set compliance level to 1.4\n\
\t-source <ver> assertions toggle (1.3 or 1.4, default is 1.3\n\
\t in -1.3 mode and 1.4 in -1.4 mode)\n\
\t-nowarn emit no warnings (same as ''-warn:none'')\n\
\t-warn:<list> emit warnings specified by comma-delimited list\n\
\t (eg ''-warn:unusedLocals,deprecation'')\n\
\t constructorName method with constructor name\n\
\t packageDefaultMethod attempt to override package-default method\n\
\t deprecation usage of deprecated type or member\n\
\t maskedCatchBlocks hidden catch block\n\
\t unusedLocals unused local variable (never read)\n\
\t unusedArguments unused method argument (never read)\n\
\t unusedImports unused imports\n\
\t syntheticAccess performing synthetic access for inner classes\n\
\t assertIdentifier ''assert'' used as identifier\n\
\t-deprecation same as ''-warn:deprecation''\n\
\t-noImportError emit no errors for unresolved imports\n\
\t-proceedOnError keep compiling after errors, dumping class files\n\
\t with problem methods\n\
\t-g[:<level>] debug attributes level\n\
\t -g all debug info (same as ''-g:lines,vars,source'')\n\
\t -g:none no debug info\n\
\t -g:<items> debug info for any/all of [lines, vars, source]\n\
\t-preserveAllLocals code gen preserve all local variables (for debug)\n\
\t-referenceInfo compute reference info\n\
\t-encoding <name> specify default source encoding format\n\
\t (Specify encoding for any source file/folder by\n\
\t suffixing each input name with '[encoding]')\n\
\t-verbose emit accessed/processed compilation units \n\
\t-log <filename> specify a log file for compile messages\n\
\t-progress show progress (requires -log mode)\n\
\t-time display speed information\n\
\t-noExit do not call System.exit(n) at end of compilation\n\
\t (n=0 if no error)\n\
\t-repeat <n> repeat compilation process <n> times (perf analysis)\n
\ Options enabled by default are prefixed with ''+''\n\
\ \n\
\ Classpath options:\n\
\ -cp -classpath <directories and zip/jar files separated by ;>\n\
\ specify location for application classes and sources\n\
\ -bootclasspath <directories and zip/jar files separated by ;>\n\
\ specify location for system classes\n\
\ -d <dir> destination directory (if omitted, no directory is created)\n\
\ -d none generate no .class files\n\
\ -encoding <enc> specify custom encoding for all sources. Each file/directory can override it\n\
\ when suffixed with ''[''<enc>'']'' (e.g. X.java[utf8])\n\
\ \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\
\ -source <version> set source level (1.3 or 1.4)\n\
\ -target <version> set classfile target (1.1 to 1.4)\n\
\ \n\
\ Warning options:\n\
\ -deprecation + deprecation outside deprecated code\n\
\ -nowarn disable all warnings\n\
\ -warn:none disable all warnings\n\
\ -warn:<warnings separated by ,> enable exactly the listed warnings\n\
\ -warn:+<warnings separated by ,> enable additional warnings\n\
\ -warn:-<warnings separated by ,> disable specific warnings\n\
\ allDeprecation deprecation including inside deprecated code\n\
\ allJavadoc invalid or missing javadoc\n\
\ assertIdentifier + ''assert'' used as identifier\n\
\ charConcat + char[] in String concat\n\
\ conditionAssign possible accidental boolean assignment\n\
\ constructorName + method with constructor name\n\
\ deprecation + deprecation outside deprecated code\n\
\ emptyBlock undocumented empty block\n\
\ fieldHiding field hiding another variable\n\
\ finally + finally block not completing normally\n\
\ indirectStatic indirect reference to static member\n\
\ intfNonInherited + interface non-inherited method compatibility\n\
\ javadoc invalid javadoc\n\
\ localHiding local variable hiding another variable\n\
\ maskedCatchBlock + hidden catch block\n\
\ nls string literal lacking non-nls tag //$NON-NLS-<n>$\n\
\ noEffectAssign + assignment without effect\n\
\ pkgDefaultMethod + attempt to override package-default method\n\
\ semicolon superfluous semicolon\n\
\ unqualifiedField unqualified reference to field\n\
\ unusedImport + unused import declaration\n\
\ unusedLocal unread local variable\n\
\ unusedPrivate unused private member declaration\n\
\ unusedThrown unused declared thrown exception\n\
\ uselessTypeCheck unnecessary cast/instanceof operation\n\
\ specialParamHiding constructor or setter parameter hiding another field\n\
\ staticReceiver + non-static reference to static member\n\
\ syntheticAccess synthetic access for innerclass\n\
\ tasks(<tags separated by |>) tasks identified by tags inside comments\n\
\ \n\
\ Debug options:\n\
\ -g[:lines,vars,source] custom debug info\n\
\ -g:lines,source + both lines table and source debug info\n\
\ -g all debug info\n\
\ -g:none no debug info\n\
\ -preserveAllLocals preserve unused local vars for debug purpose\n\
\ \n\
\ Advanced options:\n\
\ -log <file> log to a file\n\
\ -proceedOnError do not stop at first error, dumping class files with problem methods\n\
\ -verbose enable verbose output\n\
\ -referenceInfo compute reference info\n\
\ -progress show progress (only in -log mode)\n\
\ -time display speed information \n\
\ -noExit do not call System.exit(n) at end of compilation (n==0 if no error)\n\
\ -repeat <n> repeat compilation process <n> times for perf analysis\n\
\ @<file> read command line arguments from file\n\
\ \n\
\ -? -help print this help message\n\
\ -v -version print compiler version\n\
\ -showversion print compiler version and continue\n

## options not documented above (per ..ajdt.ajc.BuildArgParser.java):
# -XincrementalFile, -XnoWeave, -XserializableAspects, -XnoInline

##########################################
###############################################################################
# Copyright (c) 2000, 2004 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/cpl-v10.html
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
### JavaBatchCompiler messages.

### compiler version id
compiler.version = 0.265
### compiler
#compiler.name = Eclipse Java Compiler
#compiler.version = 0.396
#compiler.copyright = Copyright IBM Corp 2000, 2003. All rights reserved.

### scanning
scanning.start = Collecting source files inside {0}

@@ -108,16 +154,14 @@ compile.oneClassFileGenerated = 1 .class file generated
compile.severalClassFilesGenerated = {0} .class files generated

### configure
configure.noSourceFile = no source file specified
configure.requiresJDK1.2orAbove = Need to use a JVM >= 1.2
configure.duplicateLog = duplicate log specification: {0}
configure.duplicateRepeat = duplicate repeat specification: {0}
configure.duplicateCompliance = duplicate compliance setting specification: {0}
configure.source = invalid source option, source is either ''1.3'' or ''1.4'': {0}
configure.jck = invalid jck option, jck compliance level is either ''1.3'' or ''1.4'': {0}
configure.duplicateOutputPath = duplicate output path specification: {0}
configure.duplicateClasspath = duplicate classpath specification: {0}
configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
configure.invalidDebugOption = invalid debug option: {0}
configure.duplicateWarningConfiguration = duplicate usage of warning configuration
configure.invalidWarningConfiguration = invalid warning configuration: {0}
configure.invalidWarning = invalid warning: {0}
configure.invalidWarningOption = invalid warning option: {0}
@@ -125,15 +169,18 @@ configure.targetJDK = target JDK should be comprised in between ''1.1'' and ''1.
configure.incompatibleTargetForSource14 = ''1.4'' source mode requires ''-target 1.4'' : {0}
configure.incompatibleComplianceForSource14 = ''1.4'' source mode requires ''-1.4'' compliance mode: {0}
configure.incompatibleComplianceForTarget14 = ''1.4'' target mode requires ''-1.4'' compliance mode: {0}
configure.incompatibleComplianceForTarget11 = ''1.1'' target mode requires ''-1.3'' compliance mode: {0}
configure.repetition = repetition must be a positive integer: {0}
configure.directoryNotExist = directory does not exist: {0}
configure.IOError = i/o error : unable to retrieve .JAVA files in directory: {0}
configure.noClasspath =
configure.noClasspath = no classpath defined, using default directory instead
configure.incorrectClasspath = incorrect classpath: {0}
configure.noSource = no source file specified
configure.invalidexpansionargumentname = expansion argument file {0} doesn't exist or cannot be read
configure.cannotOpenLog = cannot open .log file
configure.unexpectedCustomEncoding = unexpected custom encoding specification: {0}[{1}]
configure.unsupportedEncoding = unsupported encoding format: {0}
configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0}
configure.invalidTaskTag ={0} is an invalid task tag

### requestor
requestor.error = ERROR
@@ -147,3 +194,6 @@ unit.missing = File {0} is missing

### output
output.noClassFileCreated = No .class file created for file named {0} because of an IOException.

### miscellaneous
misc.version = {compiler.name}

+ 20
- 9
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AccessForInlineVisitor.java View File

@@ -23,7 +23,8 @@ import org.aspectj.ajdt.internal.compiler.lookup.PrivilegedFieldBinding;
import org.aspectj.ajdt.internal.compiler.lookup.PrivilegedHandler;
import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.ResolvedMember;
import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
//import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
@@ -56,7 +57,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
* @author Jim Hugunin
*/

public class AccessForInlineVisitor extends AbstractSyntaxTreeVisitorAdapter {
public class AccessForInlineVisitor extends ASTVisitor {
PrivilegedHandler handler;
AspectDeclaration inAspect;
EclipseFactory world; // alias for inAspect.world
@@ -104,8 +105,8 @@ public class AccessForInlineVisitor extends AbstractSyntaxTreeVisitorAdapter {
if (send.isSuperAccess() && !send.binding.isStatic()) {
send.receiver = new ThisReference(send.sourceStart, send.sourceEnd);
send.binding = send.codegenBinding =
getSuperAccessMethod((MethodBinding)send.binding);
MethodBinding superAccessBinding = getSuperAccessMethod((MethodBinding)send.binding);
AstUtil.replaceMethodBinding(send, superAccessBinding);
} else if (!isPublic(send.binding)) {
send.syntheticAccessor = getAccessibleMethod((MethodBinding)send.binding);
}
@@ -175,13 +176,23 @@ public class AccessForInlineVisitor extends AbstractSyntaxTreeVisitorAdapter {
return ret;
}
static class SuperAccessMethodPair {
public ResolvedMember originalMethod;
public MethodBinding accessMethod;
public SuperAccessMethodPair(ResolvedMember originalMethod, MethodBinding accessMethod) {
this.originalMethod = originalMethod;
this.accessMethod = accessMethod;
}
}
private MethodBinding getSuperAccessMethod(MethodBinding binding) {
ResolvedMember m = world.makeResolvedMember(binding);
if (inAspect.superAccessForInline.containsKey(m)) return (MethodBinding)inAspect.superAccessForInline.get(m);
MethodBinding ret = world.makeMethodBinding(
AjcMemberMaker.superAccessMethod(inAspect.typeX, m)
);
inAspect.superAccessForInline.put(m, ret);
ResolvedMember superAccessMember = AjcMemberMaker.superAccessMethod(inAspect.typeX, m);
if (inAspect.superAccessForInline.containsKey(superAccessMember)) {
return ((SuperAccessMethodPair)inAspect.superAccessForInline.get(superAccessMember)).accessMethod;
}
MethodBinding ret = world.makeMethodBinding(superAccessMember);
inAspect.superAccessForInline.put(superAccessMember, new SuperAccessMethodPair(m, ret));
return ret;
}

+ 55
- 40
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java View File

@@ -38,7 +38,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.core.util.CharArrayOps;
import org.eclipse.jdt.core.compiler.CharOperation;

/**
* Represents before, after and around advice in an aspect.
@@ -123,7 +123,7 @@ public class AdviceDeclaration extends MethodDeclaration {
resize(baseArgumentCount+1, binding.parameters),
exceptions, binding.declaringClass);
proceedMethodBinding.selector =
CharArrayOps.concat(selector, proceedMethodBinding.selector);
CharOperation.concat(selector, proceedMethodBinding.selector);
}
super.resolveStatements(); //upperScope);
@@ -340,47 +340,62 @@ public class AdviceDeclaration extends MethodDeclaration {
}

public String toString(int tab) {
String s = tabString(tab);
if (modifiers != AccDefault) {
s += modifiersString(modifiers);
}

if (kind == AdviceKind.Around) {
s += returnTypeToString(0);
}
// public String toString(int tab) {
// String s = tabString(tab);
// if (modifiers != AccDefault) {
// s += modifiersString(modifiers);
// }
//
// if (kind == AdviceKind.Around) {
// s += returnTypeToString(0);
// }
//
// s += new String(selector) + "("; //$NON-NLS-1$
// if (arguments != null) {
// for (int i = 0; i < arguments.length; i++) {
// s += arguments[i].toString(0);
// if (i != (arguments.length - 1))
// s = s + ", "; //$NON-NLS-1$
// };
// };
// s += ")"; //$NON-NLS-1$
//
// if (extraArgument != null) {
// s += "(" + extraArgument.toString(0) + ")";
// }
//
//
//
// if (thrownExceptions != null) {
// s += " throws "; //$NON-NLS-1$
// for (int i = 0; i < thrownExceptions.length; i++) {
// s += thrownExceptions[i].toString(0);
// if (i != (thrownExceptions.length - 1))
// s = s + ", "; //$NON-NLS-1$
// };
// };
//
// s += ": ";
// if (pointcutDesignator != null) {
// s += pointcutDesignator.toString(0);
// }
//
// s += toStringStatements(tab + 1);
// return s;
// }

s += new String(selector) + "("; //$NON-NLS-1$
if (arguments != null) {
for (int i = 0; i < arguments.length; i++) {
s += arguments[i].toString(0);
if (i != (arguments.length - 1))
s = s + ", "; //$NON-NLS-1$
};
};
s += ")"; //$NON-NLS-1$
if (extraArgument != null) {
s += "(" + extraArgument.toString(0) + ")";
}
if (thrownExceptions != null) {
s += " throws "; //$NON-NLS-1$
for (int i = 0; i < thrownExceptions.length; i++) {
s += thrownExceptions[i].toString(0);
if (i != (thrownExceptions.length - 1))
s = s + ", "; //$NON-NLS-1$
};
};
s += ": ";
public StringBuffer printBody(int indent, StringBuffer output) {
output.append(": ");
if (pointcutDesignator != null) {
s += pointcutDesignator.toString(0);
output.append(pointcutDesignator.toString());
}
return super.printBody(indent,output);
}

s += toStringStatements(tab + 1);
return s;
public StringBuffer printReturnType(int indent, StringBuffer output) {
if (this.kind == AdviceKind.Around) {
return super.printReturnType(indent,output);
}
return output;
}
}

+ 61
- 60
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java View File

@@ -21,15 +21,19 @@ import org.aspectj.weaver.*;
import org.aspectj.weaver.patterns.*;
import org.eclipse.jdt.internal.compiler.ClassFile;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Clinit;
import org.eclipse.jdt.internal.compiler.ast.MemberTypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.codegen.Label;
import org.eclipse.jdt.internal.compiler.lookup.*;
import org.eclipse.jdt.internal.compiler.parser.Parser;


// making all aspects member types avoids a nasty hierarchy pain
public class AspectDeclaration extends MemberTypeDeclaration {
// (we used to...) making all aspects member types avoids a nasty hierarchy pain
// switched from MemberTypeDeclaration to TypeDeclaration
public class AspectDeclaration extends TypeDeclaration {
//public IAjDeclaration[] ajDeclarations;
private AjAttribute.Aspect aspectAttribute;
@@ -188,7 +192,7 @@ public class AspectDeclaration extends MemberTypeDeclaration {
}
}

if (EclipseFactory.DEBUG) System.out.println(toString(0));
if (EclipseFactory.DEBUG) System.out.println(toString());
super.generateCode(enclosingClassFile);
}
@@ -222,9 +226,9 @@ public class AspectDeclaration extends MemberTypeDeclaration {
}
private void generateInlineAccessMembers(ClassFile classFile) {
for (Iterator i = superAccessForInline.entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry)i.next();
generateSuperAccessMethod(classFile, (MethodBinding)e.getValue(), (ResolvedMember)e.getKey());
for (Iterator i = superAccessForInline.values().iterator(); i.hasNext(); ) {
AccessForInlineVisitor.SuperAccessMethodPair pair = (AccessForInlineVisitor.SuperAccessMethodPair)i.next();
generateSuperAccessMethod(classFile, pair.accessMethod, pair.originalMethod);
}
for (Iterator i = accessForInline.entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry)i.next();
@@ -752,62 +756,59 @@ public class AspectDeclaration extends MemberTypeDeclaration {
}


public String toString(int tab) {
return tabString(tab) + toStringHeader() + toStringBody(tab);
}

public String toStringBody(int tab) {

String s = " {"; //$NON-NLS-1$

if (memberTypes != null) {
for (int i = 0; i < memberTypes.length; i++) {
if (memberTypes[i] != null) {
s += "\n" + memberTypes[i].toString(tab + 1); //$NON-NLS-1$
}
}
}
if (fields != null) {
for (int fieldI = 0; fieldI < fields.length; fieldI++) {
if (fields[fieldI] != null) {
s += "\n" + fields[fieldI].toString(tab + 1); //$NON-NLS-1$
if (fields[fieldI].isField())
s += ";"; //$NON-NLS-1$
}
}
}
if (methods != null) {
for (int i = 0; i < methods.length; i++) {
if (methods[i] != null) {
s += "\n" + methods[i].toString(tab + 1); //$NON-NLS-1$
}
}
}
s += "\n" + tabString(tab) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
return s;
}

public String toStringHeader() {

String s = ""; //$NON-NLS-1$
if (modifiers != AccDefault) {
s += modifiersString(modifiers);
// public String toString(int tab) {
// return tabString(tab) + toStringHeader() + toStringBody(tab);
// }
//
// public String toStringBody(int tab) {
//
// String s = " {"; //$NON-NLS-1$
//
//
// if (memberTypes != null) {
// for (int i = 0; i < memberTypes.length; i++) {
// if (memberTypes[i] != null) {
// s += "\n" + memberTypes[i].toString(tab + 1); //$NON-NLS-1$
// }
// }
// }
// if (fields != null) {
// for (int fieldI = 0; fieldI < fields.length; fieldI++) {
// if (fields[fieldI] != null) {
// s += "\n" + fields[fieldI].toString(tab + 1); //$NON-NLS-1$
// if (fields[fieldI].isField())
// s += ";"; //$NON-NLS-1$
// }
// }
// }
// if (methods != null) {
// for (int i = 0; i < methods.length; i++) {
// if (methods[i] != null) {
// s += "\n" + methods[i].toString(tab + 1); //$NON-NLS-1$
// }
// }
// }
// s += "\n" + tabString(tab) + "}"; //$NON-NLS-2$ //$NON-NLS-1$
// return s;
// }

public StringBuffer printHeader(int indent, StringBuffer output) {
printModifiers(this.modifiers, output);
output.append("aspect " );
output.append(name);
if (superclass != null) {
output.append(" extends "); //$NON-NLS-1$
superclass.print(0, output);
}
s += "aspect " + new String(name);//$NON-NLS-1$ //$NON-NLS-2$
if (superclass != null)
s += " extends " + superclass.toString(0); //$NON-NLS-1$
if (superInterfaces != null && superInterfaces.length > 0) {
s += (isInterface() ? " extends " : " implements ");//$NON-NLS-2$ //$NON-NLS-1$
output.append(isInterface() ? " extends " : " implements ");//$NON-NLS-2$ //$NON-NLS-1$
for (int i = 0; i < superInterfaces.length; i++) {
s += superInterfaces[i].toString(0);
if (i != superInterfaces.length - 1)
s += ", "; //$NON-NLS-1$
};
};
return s;
if (i > 0) output.append( ", "); //$NON-NLS-1$
superInterfaces[i].print(0, output);
}
}
return output;
//XXX we should append the per-clause
}


}


+ 16
- 7
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java View File

@@ -21,8 +21,9 @@ import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.patterns.WildTypePattern;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Argument;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.NameReference;
import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
@@ -89,8 +90,11 @@ public class AstUtil {
public static NameReference makeNameReference(TypeBinding binding) {
char[][] name = new char[][] {binding.sourceName()};
long[] dummyPositions = new long[name.length];
QualifiedNameReference ref =
new QualifiedNameReference(new char[][] {binding.sourceName()}, 0, 0);
new QualifiedNameReference(name, dummyPositions, 0, 0);
ref.binding = binding; ref.constant = Constant.NotAConstant;
return ref;
}
@@ -130,8 +134,8 @@ public class AstUtil {
SingleNameReference ret = new SingleNameReference(binding.name, 0);
ret.binding = binding;
ret.codegenBinding = binding;
ret.constant = AstNode.NotAConstant;
ret.bits &= ~AstNode.RestrictiveFlagMASK; // clear bits
ret.constant = ASTNode.NotAConstant;
ret.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
ret.bits |= BindingIds.VARIABLE;
return ret;
}
@@ -142,8 +146,8 @@ public class AstUtil {
SingleNameReference ret = new SingleNameReference(binding.name, 0);
ret.binding = binding;
ret.codegenBinding = binding;
ret.constant = AstNode.NotAConstant;
ret.bits &= ~AstNode.RestrictiveFlagMASK; // clear bits
ret.constant = ASTNode.NotAConstant;
ret.bits &= ~ASTNode.RestrictiveFlagMASK; // clear bits
ret.bits |= BindingIds.LOCAL;
return ret;
}
@@ -284,5 +288,10 @@ public class AstUtil {
if (type == BaseTypes.DoubleBinding || type == BaseTypes.LongBinding) return 2;
else return 1;
}

public static void replaceMethodBinding(MessageSend send, MethodBinding newBinding) {
send.binding = send.codegenBinding = newBinding;
send.setActualReceiverType(newBinding.declaringClass);
}
}

+ 9
- 7
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java View File

@@ -89,12 +89,14 @@ public class DeclareDeclaration extends MethodDeclaration {
}


public StringBuffer print(int tab, StringBuffer output) {
printIndent(tab, output);
if (declareDecl == null) {
output.append("<declare>");
} else {
output.append(declareDecl.toString());
}
return output;
}




public String toString(int tab) {
if (declareDecl == null) return tabString(tab) + "<declare>";
else return tabString(tab) + declareDecl.toString();
}
}

+ 2
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterSuperFixerVisitor.java View File

@@ -17,7 +17,7 @@ import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceLocation;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
@@ -33,7 +33,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
* @author Jim Hugunin
*/

public class InterSuperFixerVisitor extends AbstractSyntaxTreeVisitorAdapter {
public class InterSuperFixerVisitor extends ASTVisitor {
InterTypeDeclaration dec;
ReferenceBinding onType;
TypeBinding superType;

+ 2
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeConstructorDeclaration.java View File

@@ -41,7 +41,7 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
public void parseStatements(Parser parser, CompilationUnitDeclaration unit) {
if (ignoreFurtherInvestigation)
return;
parser.parseAsConstructor(this, unit);
parser.parse(this, unit);
}

public void resolve(ClassScope upperScope) {
@@ -262,5 +262,5 @@ public class InterTypeConstructorDeclaration extends InterTypeDeclaration {
protected Shadow.Kind getShadowKindForBody() {
return Shadow.ConstructorExecution;
}
}

+ 1
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/KnownFieldReference.java View File

@@ -23,7 +23,7 @@ public class KnownFieldReference extends QualifiedNameReference {

//XXX handle source locations
public KnownFieldReference(FieldBinding binding, long pos) {
super(new char[][] {binding.name}, 0, 0);
super(new char[][] {binding.name},new long[1], 0, 0);
this.binding = this.codegenBinding = binding;
this.constant = Constant.NotAConstant;
this.receiverType = this.actualReceiverType =

+ 23
- 15
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/MakeDeclsPublicVisitor.java View File

@@ -13,11 +13,12 @@

package org.aspectj.ajdt.internal.compiler.ast;

import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
//import org.eclipse.jdt.internal.compiler.ast.AnonymousLocalTypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.LocalTypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
//import org.eclipse.jdt.internal.compiler.ast.LocalTypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
@@ -28,18 +29,7 @@ import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
* thisJoinPointStaticPart, thisJoinPoint and thisEnclosingJoinPointStaticPart
*/

public class MakeDeclsPublicVisitor extends AbstractSyntaxTreeVisitorAdapter {
public void endVisit(
AnonymousLocalTypeDeclaration decl,
BlockScope scope) {
decl.binding.modifiers = AstUtil.makePublic(decl.binding.modifiers);
}
public void endVisit(LocalTypeDeclaration decl, BlockScope scope) {
decl.binding.modifiers = AstUtil.makePublic(decl.binding.modifiers);
}

public class MakeDeclsPublicVisitor extends ASTVisitor {

public void endVisit(ConstructorDeclaration decl, ClassScope scope) {
decl.binding.modifiers = AstUtil.makePublic(decl.binding.modifiers);
@@ -54,4 +44,22 @@ public class MakeDeclsPublicVisitor extends AbstractSyntaxTreeVisitorAdapter {
decl.binding.modifiers = AstUtil.makePublic(decl.binding.modifiers);
}

/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#endVisit(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
*/
public void endVisit(
TypeDeclaration localTypeDeclaration,
BlockScope scope) {
localTypeDeclaration.binding.modifiers = AstUtil.makePublic(localTypeDeclaration.binding.modifiers);
}

/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ASTVisitor#endVisit(org.eclipse.jdt.internal.compiler.ast.TypeDeclaration, org.eclipse.jdt.internal.compiler.lookup.ClassScope)
*/
public void endVisit(
TypeDeclaration memberTypeDeclaration,
ClassScope scope) {
memberTypeDeclaration.binding.modifiers = AstUtil.makePublic(memberTypeDeclaration.binding.modifiers);
}

}

+ 12
- 21
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDeclaration.java View File

@@ -158,27 +158,18 @@ public class PointcutDeclaration extends MethodDeclaration {
return;
}
public String toString(int tab) {
StringBuffer buf = new StringBuffer();
buf.append(tabString(tab));
if (modifiers != 0) {
buf.append(modifiersString(modifiers));
}
public StringBuffer printReturnType(int indent, StringBuffer output) {
return output.append("pointcut");
}

buf.append("pointcut ");
buf.append(new String(selector));
buf.append("(");
if (arguments != null) {
for (int i = 0; i < arguments.length; i++) {
if (i > 0) buf.append(", ");
buf.append(arguments[i].toString(0));
};
};
buf.append("): ");

buf.append(getPointcut());

buf.append(";");
return buf.toString();
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration#printBody(int, java.lang.StringBuffer)
*/
public StringBuffer printBody(int indent, StringBuffer output) {
output.append(": ");
output.append(getPointcut());
output.append(";");
return output;
}

}

+ 10
- 8
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PointcutDesignator.java View File

@@ -20,7 +20,7 @@ import org.aspectj.weaver.patterns.FormalBinding;
import org.aspectj.weaver.patterns.Pointcut;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Argument;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
@@ -28,7 +28,7 @@ import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.parser.Parser;

public class PointcutDesignator extends AstNode {
public class PointcutDesignator extends ASTNode {
private Pointcut pointcut;
private PseudoTokens tokens; //XXX redundant
private boolean isError = false;
@@ -51,12 +51,6 @@ public class PointcutDesignator extends AstNode {
}


public String toString(int tab) {
if (pointcut == null) return "<pcd>";
return pointcut.toString();
}

public boolean finishResolveTypes(final AbstractMethodDeclaration dec, MethodBinding method, final int baseArgumentCount, SourceTypeBinding sourceTypeBinding) {
//System.err.println("resolving: " + this);
//Thread.currentThread().dumpStack();
@@ -91,4 +85,12 @@ public class PointcutDesignator extends AstNode {
return isError;
}

/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ast.ASTNode#print(int, java.lang.StringBuffer)
*/
public StringBuffer print(int indent, StringBuffer output) {
if (pointcut == null) return output.append("<pcd>");
return output.append(pointcut.toString());
}

}

+ 2
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ProceedVisitor.java View File

@@ -14,7 +14,7 @@
package org.aspectj.ajdt.internal.compiler.ast;

import org.aspectj.weaver.Advice;
import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
@@ -33,7 +33,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
* thisJoinPointStaticPart, thisJoinPoint and thisEnclosingJoinPointStaticPart
*/

public class ProceedVisitor extends AbstractSyntaxTreeVisitorAdapter {
public class ProceedVisitor extends ASTVisitor {
boolean needsDynamic = false;
boolean needsStatic = false;
boolean needsStaticEnclosing = false;

+ 10
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PseudoToken.java View File

@@ -15,14 +15,14 @@ package org.aspectj.ajdt.internal.compiler.ast;

import org.aspectj.weaver.patterns.IToken;
import org.aspectj.weaver.patterns.Pointcut;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.parser.Parser;

/**
*/
public class PseudoToken extends AstNode implements IToken {
public class PseudoToken extends ASTNode implements IToken {
public String value;
public boolean isIdentifier;
public String literalKind = null;
@@ -84,4 +84,12 @@ public class PseudoToken extends AstNode implements IToken {
// nothing to do typically
}

/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ast.ASTNode#print(int, java.lang.StringBuffer)
*/
public StringBuffer print(int indent, StringBuffer output) {
output.append("PseudoToken<" + getString() + ">");
return output;
}

}

+ 12
- 5
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/PseudoTokens.java View File

@@ -24,13 +24,14 @@ import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.PerSingleton;
import org.aspectj.weaver.patterns.Pointcut;
import org.aspectj.weaver.patterns.TypePattern;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.parser.Parser;
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;


public class PseudoTokens extends AstNode {
public class PseudoTokens extends ASTNode {
BasicTokenSource tokenSource;
PseudoToken[] tokens; //XXX this is redundant with the field above
String endToken;
@@ -61,6 +62,7 @@ public class PseudoTokens extends AstNode {
IToken last = tokenSource.next();
if (tokenSource.next() != IToken.EOF) {
parser.problemReporter().parseError(last.getStart(), last.getEnd(),
TerminalTokens.TokenNameIdentifier,
last.getString().toCharArray(),
last.getString(),
new String[] {endToken});
@@ -84,6 +86,7 @@ public class PseudoTokens extends AstNode {
}
parser.problemReporter().parseError(start, end,
TerminalTokens.TokenNameIdentifier,
found.toCharArray(),
found,
new String[] {pe.getMessage()});
@@ -143,8 +146,12 @@ public class PseudoTokens extends AstNode {
}
}
public String toString(int tab) {
return tokenSource.toString();
/* (non-Javadoc)
* @see org.eclipse.jdt.internal.compiler.ast.ASTNode#print(int, java.lang.StringBuffer)
*/
public StringBuffer print(int indent, StringBuffer output) {
output.append(tokenSource.toString());
return output;
}

}

+ 6
- 6
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/SuperFixerVisitor.java View File

@@ -20,9 +20,9 @@ import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.compiler.lookup.InterTypeMethodBinding;
import org.aspectj.weaver.NameMangler;
import org.aspectj.weaver.ResolvedMember;
import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
@@ -35,7 +35,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
* thisJoinPointStaticPart, thisJoinPoint and thisEnclosingJoinPointStaticPart
*/

public class SuperFixerVisitor extends AbstractSyntaxTreeVisitorAdapter {
public class SuperFixerVisitor extends ASTVisitor {
Set superMethodsCalled = new HashSet();
AbstractMethodDeclaration method;
ReferenceBinding targetClass;
@@ -90,11 +90,11 @@ public class SuperFixerVisitor extends AbstractSyntaxTreeVisitorAdapter {
//??? do we want these to be unique
MethodBinding superAccessBinding =
new MethodBinding(AstNode.AccPublic, accessName,
new MethodBinding(ASTNode.AccPublic, accessName,
superBinding.returnType, superBinding.parameters, superBinding.thrownExceptions,
targetClass);
call.codegenBinding = superAccessBinding;
AstUtil.replaceMethodBinding(call, superAccessBinding);
ResolvedMember targetMember = EclipseFactory.makeResolvedMember(superBinding);
superMethodsCalled.add(targetMember);

+ 3
- 3
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ThisJoinPointVisitor.java View File

@@ -14,7 +14,7 @@
package org.aspectj.ajdt.internal.compiler.ast;

import org.aspectj.weaver.Advice;
import org.eclipse.jdt.internal.compiler.AbstractSyntaxTreeVisitorAdapter;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
@@ -33,7 +33,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
* thisJoinPointStaticPart, thisJoinPoint and thisEnclosingJoinPointStaticPart
*/

public class ThisJoinPointVisitor extends AbstractSyntaxTreeVisitorAdapter {
public class ThisJoinPointVisitor extends ASTVisitor {
boolean needsDynamic = false;
boolean needsStatic = false;
boolean needsStaticEnclosing = false;
@@ -170,7 +170,7 @@ public class ThisJoinPointVisitor extends AbstractSyntaxTreeVisitorAdapter {
call.setActualReceiverType(thisJoinPointStaticPartType);

call.binding = call.codegenBinding = getEquivalentStaticBinding(call.binding);
AstUtil.replaceMethodBinding(call, getEquivalentStaticBinding(call.binding));
}
private MethodBinding getEquivalentStaticBinding(MethodBinding template) {

+ 3
- 3
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java View File

@@ -126,7 +126,7 @@ public class EclipseFactory {
return ret;
}

public static AstNode astForLocation(IHasPosition location) {
public static ASTNode astForLocation(IHasPosition location) {
return new EmptyStatement(location.getStart(), location.getEnd());
}
@@ -307,12 +307,12 @@ public class EclipseFactory {
}


public Shadow makeShadow(AstNode location, ReferenceContext context) {
public Shadow makeShadow(ASTNode location, ReferenceContext context) {
return EclipseShadow.makeShadow(this, location, context);
}
public Shadow makeShadow(ReferenceContext context) {
return EclipseShadow.makeShadow(this, (AstNode) context, context);
return EclipseShadow.makeShadow(this, (ASTNode) context, context);
}
public void addSourceTypeBinding(SourceTypeBinding binding) {

+ 3
- 3
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java View File

@@ -30,11 +30,11 @@ import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
*/
public class EclipseShadow extends Shadow {
EclipseFactory world;
AstNode astNode;
ASTNode astNode;
ReferenceContext context;
//AbstractMethodDeclaration enclosingMethod;

public EclipseShadow(EclipseFactory world, Kind kind, Member signature, AstNode astNode,
public EclipseShadow(EclipseFactory world, Kind kind, Member signature, ASTNode astNode,
ReferenceContext context)
{
super(kind, signature, null);
@@ -103,7 +103,7 @@ public class EclipseShadow extends Shadow {
// --- factory methods
public static EclipseShadow makeShadow(EclipseFactory world, AstNode astNode,
public static EclipseShadow makeShadow(EclipseFactory world, ASTNode astNode,
ReferenceContext context)
{
//XXX make sure we're getting the correct declaring type at call-site

+ 2
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InlineAccessFieldBinding.java View File

@@ -15,7 +15,7 @@ package org.aspectj.ajdt.internal.compiler.lookup;

import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration;
import org.aspectj.weaver.AjcMemberMaker;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
@@ -53,7 +53,7 @@ public class InlineAccessFieldBinding extends FieldBinding {
inAspect.typeX, inAspect.factory.makeResolvedMember(baseField)
)));
this.constant = AstNode.NotAConstant;
this.constant = ASTNode.NotAConstant;
this.baseField = baseField;
}


+ 5
- 3
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeMemberFinder.java View File

@@ -41,7 +41,7 @@ public class InterTypeMemberFinder implements IMemberFinder {
InvocationSite site,
Scope scope)
{
FieldBinding retField = sourceTypeBinding.getFieldBase(fieldName);
FieldBinding retField = sourceTypeBinding.getFieldBase(fieldName, false); // XXX may need to get the correct value for second parameter in the future
if (interTypeFields.isEmpty()) return retField;
int fieldLength = fieldName.length;
@@ -63,8 +63,10 @@ public class InterTypeMemberFinder implements IMemberFinder {
Scope scope)
{
if (retField == null) return field;
if (!field.canBeSeenBy(sourceTypeBinding, site, scope)) return retField;
if (!retField.canBeSeenBy(sourceTypeBinding, site, scope)) return field;
if (site != null) {
if (!field.canBeSeenBy(sourceTypeBinding, site, scope)) return retField;
if (!retField.canBeSeenBy(sourceTypeBinding, site, scope)) return field;
}
//XXX need dominates check on aspects
return new ProblemFieldBinding(retField.declaringClass, retField.name, ProblemReporter.Ambiguous);
}

+ 2
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedFieldBinding.java View File

@@ -15,7 +15,7 @@ package org.aspectj.ajdt.internal.compiler.lookup;

import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration;
import org.aspectj.weaver.AjcMemberMaker;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
@@ -42,7 +42,7 @@ public class PrivilegedFieldBinding extends FieldBinding {
inAspect.typeX, inAspect.factory.makeResolvedMember(baseField)
)));
this.constant = AstNode.NotAConstant;
this.constant = ASTNode.NotAConstant;
this.baseField = baseField;
}


+ 5
- 5
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/PrivilegedHandler.java View File

@@ -28,7 +28,7 @@ import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.TypeX;
import org.aspectj.weaver.World;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.IPrivilegedHandler;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
@@ -44,7 +44,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
this.inAspect = inAspect;
}

public FieldBinding getPrivilegedAccessField(FieldBinding baseField, AstNode location) {
public FieldBinding getPrivilegedAccessField(FieldBinding baseField, ASTNode location) {
ResolvedMember key = inAspect.factory.makeResolvedMember(baseField);
if (accessors.containsKey(key)) return (FieldBinding)accessors.get(key);
FieldBinding ret = new PrivilegedFieldBinding(inAspect, baseField);
@@ -53,7 +53,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
return ret;
}

public MethodBinding getPrivilegedAccessMethod(MethodBinding baseMethod, AstNode location) {
public MethodBinding getPrivilegedAccessMethod(MethodBinding baseMethod, ASTNode location) {
if (baseMethod.alwaysNeedsAccessMethod()) return baseMethod;
ResolvedMember key = EclipseFactory.makeResolvedMember(baseMethod);
@@ -75,7 +75,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
return ret;
}
public void notePrivilegedTypeAccess(ReferenceBinding type, AstNode location) {
public void notePrivilegedTypeAccess(ReferenceBinding type, ASTNode location) {
ResolvedMember key =
new ResolvedMember(Member.STATIC_INITIALIZATION,
inAspect.factory.fromEclipse(type), 0, ResolvedTypeX.VOID, "", TypeX.NONE);
@@ -84,7 +84,7 @@ public class PrivilegedHandler implements IPrivilegedHandler {
accessors.put(key, key);
}

private void checkWeaveAccess(TypeX typeX, AstNode location) {
private void checkWeaveAccess(TypeX typeX, ASTNode location) {
World world = inAspect.factory.getWorld();
Lint.Kind check = world.getLint().typeNotExposedToWeaver;
if (check.isEnabled()) {

+ 978
- 1289
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java
File diff suppressed because it is too large
View File


+ 6
- 7
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjScanner.java View File

@@ -15,25 +15,24 @@
package org.aspectj.ajdt.internal.compiler.parser;

import org.aspectj.ajdt.compiler.IAjTerminalSymbols;
import org.eclipse.jdt.core.compiler.IScanner;
import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.internal.compiler.parser.Scanner;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.parser.Scanner;
import org.eclipse.jdt.internal.compiler.parser.TerminalTokens;


public class AjScanner extends Scanner implements IScanner {
public class AjScanner extends Scanner implements TerminalTokens {
public AjScanner(
boolean tokenizeComments,
boolean tokenizeWhiteSpace,
boolean checkNonExternalizedStringLiterals,
boolean assertMode,
long sourceLevel,
char[][] taskTags,
char[][] taskPriorities) {
super(
tokenizeComments,
tokenizeWhiteSpace,
checkNonExternalizedStringLiterals,
assertMode,
sourceLevel,
taskTags,
taskPriorities);
}
@@ -55,7 +54,7 @@ public class AjScanner extends Scanner implements IScanner {
public int scanIdentifierOrKeyword() throws InvalidInputException {
public int scanIdentifierOrKeyword() {
int kind = super.scanIdentifierOrKeyword();
if (kind != IAjTerminalSymbols.TokenNameIdentifier) return kind;

BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser1.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser10.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser11.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser12.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser13.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser14.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser15.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser16.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser17.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser18.rsc View File


+ 1
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser19.rsc View File

@@ -0,0 +1 @@
]]IIIJJ^0003I[3000000Y!3M'Jdd

BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser2.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser20.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser3.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser4.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser5.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser6.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser7.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser8.rsc View File


BIN
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/parser9.rsc View File


+ 202
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/readableNames.properties View File

@@ -0,0 +1,202 @@
,opt=,
AbstractMethodDeclaration=AbstractMethodDeclaration
AdditiveExpression=Expression
AllocationHeader=AllocationHeader
AndExpression=Expression
ArgumentList=ArgumentList
ArgumentListopt=ArgumentList
ArrayAccess=ArrayAccess
ArrayCreationHeader=ArrayCreationHeader
ArrayCreationWithArrayInitializer=ArrayCreationWithArrayInitializer
ArrayCreationWithoutArrayInitializer=ArrayCreationWithoutArrayInitializer
ArrayInitializer=ArrayInitializer
ArrayType=ArrayType
AssertStatement=AssertStatement
Assignment=Assignment
AssignmentExpression=Expression
AssignmentOperator=AssignmentOperator
Block=Block
BlockStatement=BlockStatement
BlockStatements=BlockStatements
BlockStatementsopt=BlockStatements
BooleanLiteral=BooleanLiteral
BreakStatement=BreakStatement
CastExpression=CastExpression
CatchClause=CatchClause
CatchHeader=CatchHeader
Catches=Catches
Catchesopt=Catches
ClassBody=ClassBody
ClassBodyDeclaration=ClassBodyDeclaration
ClassBodyDeclarations=ClassBodyDeclarations
ClassBodyDeclarationsopt=ClassBodyDeclarations
ClassBodyopt=ClassBody
ClassDeclaration=ClassDeclaration
ClassHeader=ClassHeader
ClassHeaderExtends=ClassHeaderExtends
ClassHeaderExtendsopt=ClassHeaderExtends
ClassHeaderImplements=ClassHeaderImplements
ClassHeaderImplementsopt=ClassHeaderImplements
ClassHeaderName=ClassHeaderName
ClassInstanceCreationExpression=ClassInstanceCreationExpression
ClassInstanceCreationExpressionName=ClassInstanceCreationExpressionName
ClassMemberDeclaration=ClassMemberDeclaration
ClassOrInterfaceType=Type
ClassType=ClassType
ClassTypeElt=ClassType
ClassTypeList=ClassTypeList
CompilationUnit=CompilationUnit
ConditionalAndExpression=Expression
ConditionalExpression=Expression
ConditionalOrExpression=Expression
ConstantDeclaration=ConstantDeclaration
ConstantExpression=ConstantExpression
ConstructorDeclaration=ConstructorDeclaration
ConstructorHeader=ConstructorHeader
ConstructorHeaderName=ConstructorHeaderName
ContinueStatement=ContinueStatement
Diet=Diet
DimWithOrWithOutExpr=Dimension
DimWithOrWithOutExprs=Dimensions
Dims=Dimensions
DimsLoop=Dimensions
Dimsopt=Dimensions
DoStatement=DoStatement
EmptyStatement=EmptyStatement
EnterAnonymousClassBody=EnterAnonymousClassBody
EnterCompilationUnit=EnterCompilationUnit
EnterVariable=EnterVariable
EqualityExpression=Expression
ExclusiveOrExpression=Expression
ExitTryBlock=ExitTryBlock
ExitVariableWithInitialization=ExitVariableWithInitialization
ExitVariableWithoutInitialization=ExitVariableWithoutInitialization
ExplicitConstructorInvocation=ExplicitConstructorInvocation
Expression=Expression
ExpressionStatement=Statement
Expressionopt=Expression
FieldAccess=FieldAccess
FieldDeclaration=FieldDeclaration
Finally=Finally
FloatingPointType=FloatingPointType
ForInit=ForInit
ForInitopt=ForInit
ForStatement=ForStatement
ForStatementNoShortIf=ForStatement
ForUpdate=ForUpdate
ForUpdateopt=ForUpdate
ForceNoDiet=ForceNoDiet
FormalParameter=FormalParameter
FormalParameterList=FormalParameterList
FormalParameterListopt=FormalParameterList
GenericMethodDeclaration=GenericMethodDeclaration
Goal=Goal
Header=Header
Headers=Headers
IfThenElseStatement=IfStatement
IfThenElseStatementNoShortIf=IfStatement
IfThenStatement=IfStatement
ImportDeclaration=ImportDeclaration
ImportDeclarations=ImportDeclarations
ImportDeclarationsopt=ImportDeclarations
InclusiveOrExpression=Expression
Initializer=Initializer
InsideCastExpression=InsideCastExpression
InsideCastExpressionLL1=InsideCastExpression
IntegralType=IntegralType
InterfaceBody=InterfaceBody
InterfaceDeclaration=InterfaceDeclaration
InterfaceHeader=InterfaceHeader
InterfaceHeaderExtends=InterfaceHeaderExtends
InterfaceHeaderExtendsopt=InterfaceHeaderExtends
InterfaceHeaderName=InterfaceHeaderName
InterfaceMemberDeclaration=InterfaceMemberDeclaration
InterfaceMemberDeclarations=InterfaceMemberDeclarations
InterfaceMemberDeclarationsopt=InterfaceMemberDeclarations
InterfaceType=InterfaceType
InterfaceTypeList=InterfaceTypeList
InvalidArrayInitializerAssignement=ArrayInitializerAssignement
InvalidConstructorDeclaration=InvalidConstructorDeclaration
InvalidInterfaceDeclaration=InvalidInterfaceDeclaration
InvalidMethodDeclaration=InvalidMethodDeclaration
LabeledStatement=LabeledStatement
LabeledStatementNoShortIf=LabeledStatement
Literal=Literal
LocalVariableDeclaration=LocalVariableDeclaration
LocalVariableDeclarationStatement=LocalVariableDeclarationStatement
MethodBody=MethodBody
MethodDeclaration=MethodDeclaration
MethodHeader=MethodHeader
MethodHeaderExtendedDims=MethodHeaderExtendedDims
MethodHeaderName=MethodHeaderName
MethodHeaderParameters=MethodHeaderParameters
MethodHeaderThrowsClause=MethodHeaderThrowsClause
MethodHeaderThrowsClauseopt=MethodHeaderThrowsClause
MethodInvocation=MethodInvocation
Modifier=Modifier
Modifiers=Modifiers
Modifiersopt=Modifiers
MultiplicativeExpression=Expression
Name=Name
NestedMethod=NestedMethod
NestedType=NestedType
NumericType=NumericType
OneDimLoop=Dimension
OnlySynchronized=OnlySynchronized
OpenBlock=OpenBlock
PackageDeclaration=PackageDeclaration
PackageDeclarationName=PackageDeclarationName
PackageDeclarationopt=PackageDeclaration
PostDecrementExpression=PostDecrementExpression
PostIncrementExpression=PostIncrementExpression
PostfixExpression=Expression
PreDecrementExpression=PreDecrementExpression
PreIncrementExpression=PreIncrementExpression
Primary=Expression
PrimaryNoNewArray=Expression
PrimitiveType=PrimitiveType
PushLPAREN=(
PushModifiers=PushModifiers
PushPosition=PushPosition
PushRPAREN=)
QualifiedName=QualifiedName
ReferenceType=ReferenceType
RelationalExpression=Expression
RestoreDiet=RestoreDiet
ReturnStatement=ReturnStatement
ShiftExpression=Expression
SimpleName=SimpleName
SingleTypeImportDeclaration=SingleTypeImportDeclaration
SingleTypeImportDeclarationName=SingleTypeImportDeclarationName
Statement=Statement
StatementExpression=Expression
StatementExpressionList=StatementExpressionList
StatementNoShortIf=Statement
StatementWithoutTrailingSubstatement=Statement
StaticInitializer=StaticInitializer
StaticOnly=StaticOnly
SwitchBlock=SwitchBlock
SwitchBlockStatement=SwitchBlockStatement
SwitchBlockStatements=SwitchBlockStatements
SwitchLabel=SwitchLabel
SwitchLabels=SwitchLabels
SwitchStatement=SwitchStatement
SynchronizedStatement=SynchronizedStatement
ThrowStatement=ThrowStatement
TryBlock=Block
TryStatement=TryStatement
Type=Type
TypeDeclaration=TypeDeclaration
TypeDeclarations=TypeDeclarations
TypeDeclarationsopt=TypeDeclarations
TypeImportOnDemandDeclaration=TypeImportOnDemandDeclaration
TypeImportOnDemandDeclarationName=TypeImportOnDemandDeclarationName
UnaryExpression=Expression
UnaryExpressionNotPlusMinus=Expression
VariableDeclarator=VariableDeclarator
VariableDeclaratorId=VariableDeclaratorId
VariableDeclarators=VariableDeclarators
VariableInitializer=VariableInitializer
VariableInitializers=VariableInitializers
WhileStatement=WhileStatement
WhileStatementNoShortIf=WhileStatement

+ 2
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java View File

@@ -28,7 +28,7 @@ import org.aspectj.weaver.patterns.DeclareSoft;
import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
import org.eclipse.jdt.internal.compiler.IProblemFactory;
import org.eclipse.jdt.internal.compiler.ast.AstNode;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
@@ -62,7 +62,7 @@ public class AjProblemReporter extends ProblemReporter {

public void unhandledException(
TypeBinding exceptionType,
AstNode location)
ASTNode location)
{
if (!world.getWorld().getDeclareSoft().isEmpty()) {
Shadow callSite = world.makeShadow(location, referenceContext);

+ 18
- 6
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java View File

@@ -31,6 +31,8 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
*/
public class AjBuildConfig { // XXX needs bootclasspath?
private boolean shouldProceed = true;
public static final String AJLINT_IGNORE = "ignore";
public static final String AJLINT_WARN = "warn";
public static final String AJLINT_ERROR = "error";
@@ -88,12 +90,12 @@ public class AjBuildConfig { // XXX needs bootclasspath?
javaOptions.put(
CompilerOptions.OPTION_PreserveUnusedLocal,
CompilerOptions.OPTIMIZE_OUT);
javaOptions.put(
CompilerOptions.OPTION_ReportUnreachableCode,
CompilerOptions.IGNORE);
javaOptions.put(
CompilerOptions.OPTION_ReportInvalidImport,
CompilerOptions.ERROR);
// javaOptions.put(
// CompilerOptions.OPTION_ReportUnreachableCode,
// CompilerOptions.IGNORE);
// javaOptions.put(
// CompilerOptions.OPTION_ReportInvalidImport,
// CompilerOptions.ERROR);
javaOptions.put(
CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod,
CompilerOptions.WARNING);
@@ -440,4 +442,14 @@ public class AjBuildConfig { // XXX needs bootclasspath?
sourcePathResources = map;
}

/**
* used to indicate whether to proceed after parsing config
*/
public boolean shouldProceed() {
return shouldProceed;
}

public void doNotProceed() {
shouldProceed = false;
}
}

+ 1
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java View File

@@ -374,8 +374,7 @@ public class AjBuildManager {
compiler.parser =
new AjParser(
pr,
compiler.options.parseLiteralExpressionsAsConstants,
compiler.options.sourceLevel >= CompilerOptions.JDK1_4);
compiler.options.parseLiteralExpressionsAsConstants);

CompilerOptions options = compiler.options;


+ 13
- 2
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjState.java View File

@@ -29,6 +29,7 @@ import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
import org.eclipse.jdt.internal.core.builder.ReferenceCollection;
import org.eclipse.jdt.internal.core.builder.StringSet;


/**
@@ -239,16 +240,26 @@ public class AjState {
return cf;
}
private static StringSet makeStringSet(List strings) {
StringSet ret = new StringSet(strings.size());
for (Iterator iter = strings.iterator(); iter.hasNext();) {
String element = (String) iter.next();
ret.add(element);
}
return ret;
}
protected void addAffectedSourceFiles(List sourceFiles) {
if (qualifiedStrings.isEmpty() && simpleStrings.isEmpty()) return;

// the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are just 'X'
char[][][] qualifiedNames = ReferenceCollection.internQualifiedNames(qualifiedStrings);
char[][][] qualifiedNames = ReferenceCollection.internQualifiedNames(makeStringSet(qualifiedStrings));
// if a well known qualified name was found then we can skip over these
if (qualifiedNames.length < qualifiedStrings.size())
qualifiedNames = null;
char[][] simpleNames = ReferenceCollection.internSimpleNames(simpleStrings);
char[][] simpleNames = ReferenceCollection.internSimpleNames(makeStringSet(simpleStrings));
// if a well known name was found then we can skip over these
if (simpleNames.length < simpleStrings.size())
simpleNames = null;

+ 1
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmElementFormatter.java View File

@@ -38,7 +38,7 @@ public class AsmElementFormatter {
node.setKind(IProgramElement.Kind.ADVICE);

if (ad.kind == AdviceKind.Around) {
node.setReturnType(ad.returnTypeToString(0));
node.setReturnType(ad.returnType.toString()); //returnTypeToString(0));
}
String details = "";

+ 8
- 15
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java View File

@@ -29,7 +29,7 @@ import org.eclipse.jdt.internal.compiler.ast.*;
import org.eclipse.jdt.internal.compiler.lookup.*;
import org.eclipse.jdt.internal.compiler.problem.ProblemHandler;

public class AsmHierarchyBuilder extends AbstractSyntaxTreeVisitorAdapter {
public class AsmHierarchyBuilder extends ASTVisitor {
public static void build(
CompilationUnitDeclaration unit,
@@ -193,7 +193,7 @@ public class AsmHierarchyBuilder extends AbstractSyntaxTreeVisitorAdapter {
}
// ??? share impl with visit(TypeDeclaration, ..) ?
public boolean visit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope) {
public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
String name = new String(memberTypeDeclaration.name);
//System.err.println("member type with name: " + name);
@@ -213,11 +213,11 @@ public class AsmHierarchyBuilder extends AbstractSyntaxTreeVisitorAdapter {
stack.push(peNode);
return true;
}
public void endVisit(MemberTypeDeclaration memberTypeDeclaration, ClassScope scope) {
public void endVisit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
stack.pop();
}
public boolean visit(LocalTypeDeclaration memberTypeDeclaration, BlockScope scope) {
public boolean visit(TypeDeclaration memberTypeDeclaration, BlockScope scope) {
String name = new String(memberTypeDeclaration.name);
String fullName = "<undefined>";
@@ -248,17 +248,10 @@ public class AsmHierarchyBuilder extends AbstractSyntaxTreeVisitorAdapter {
stack.push(peNode);
return true;
}
public void endVisit(LocalTypeDeclaration memberTypeDeclaration, BlockScope scope) {
public void endVisit(TypeDeclaration memberTypeDeclaration, BlockScope scope) {
stack.pop();
}
public boolean visit(AnonymousLocalTypeDeclaration memberTypeDeclaration, BlockScope scope) {
return visit((LocalTypeDeclaration)memberTypeDeclaration, scope);
}

public void endVisit(AnonymousLocalTypeDeclaration memberTypeDeclaration, BlockScope scope) {
stack.pop();
}
private IProgramElement findEnclosingClass(Stack stack) {
for (int i = stack.size()-1; i >= 0; i--) {
@@ -442,7 +435,7 @@ public class AsmHierarchyBuilder extends AbstractSyntaxTreeVisitorAdapter {
}

// ??? handle non-existant files
private ISourceLocation makeLocation(AstNode node) {
private ISourceLocation makeLocation(ASTNode node) {
String fileName = "";
if (currCompilationResult.getFileName() != null) {
fileName = new String(currCompilationResult.getFileName());
@@ -464,7 +457,7 @@ public class AsmHierarchyBuilder extends AbstractSyntaxTreeVisitorAdapter {
// AMC - overloaded set of methods to get start and end lines for
// various ASTNode types. They have no common ancestor in the
// hierarchy!!
private int getStartLine( AstNode n){
private int getStartLine( ASTNode n){
// if ( n instanceof AbstractVariableDeclaration ) return getStartLine( (AbstractVariableDeclaration)n);
// if ( n instanceof AbstractMethodDeclaration ) return getStartLine( (AbstractMethodDeclaration)n);
// if ( n instanceof TypeDeclaration ) return getStartLine( (TypeDeclaration)n);
@@ -476,7 +469,7 @@ public class AsmHierarchyBuilder extends AbstractSyntaxTreeVisitorAdapter {
// AMC - overloaded set of methods to get start and end lines for
// various ASTNode types. They have no common ancestor in the
// hierarchy!!
private int getEndLine( AstNode n){
private int getEndLine( ASTNode n){
if ( n instanceof AbstractVariableDeclaration ) return getEndLine( (AbstractVariableDeclaration)n);
if ( n instanceof AbstractMethodDeclaration ) return getEndLine( (AbstractMethodDeclaration)n);
if ( n instanceof TypeDeclaration ) return getEndLine( (TypeDeclaration)n);

+ 2
- 5
org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java View File

@@ -20,6 +20,7 @@ import java.io.PrintStream;
import java.util.Arrays;
import java.util.List;

import org.aspectj.ajdt.ajc.BuildArgParser;
import org.aspectj.bridge.AbortException;
import org.aspectj.bridge.ICommand;
import org.aspectj.bridge.IMessage;
@@ -194,11 +195,7 @@ public class Main {
public void run(String[] args, IMessageHolder holder) {
if (LangUtil.isEmpty(args)) {
args = new String[] { "-help" };
} else if (Arrays.asList(args).contains("-version")) {
System.out.println("AspectJ Compiler " + Version.text);
System.out.println();
return;
} else if (controller.running()) {
} else if (controller.running()) {
fail(holder, "already running with controller: " + controller, null);
return;
}

+ 40
- 11
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/AjdtCommandTestCase.java View File

@@ -160,25 +160,54 @@ public class AjdtCommandTestCase extends TestCase {
}
public void testHelpUsagePrinting() {
String[] args = new String[] { "-help" };
PrintStream saveOut = System.out;
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
PrintStream newOut = new PrintStream(byteArrayOut);
System.setOut(newOut);
try {
command.genBuildConfig(
new String[] { "-help" },
counter);
} catch (AbortException ae) { }
try {
command.genBuildConfig(
args,
counter);
} catch (AbortException ae) { }
} finally {
System.setOut(saveOut);
}
String text = byteArrayOut.toString();
assertTrue(
outputWriter.getContents() + " contains? " + "Usage",
outputWriter.getContents().indexOf("Usage") != -1);
text + " contains? " + "Usage",
text.indexOf("Usage") != -1);
}
public void testVersionOutput() throws InvalidInputException {
String[] args = new String[] { "-version" };
PrintStream saveOut = System.err;
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
PrintStream newOut = new PrintStream(byteArrayOut);
System.setErr(newOut);
try {
command.genBuildConfig(
new String[] { "-version" },
counter);
} catch (AbortException ae) { }
try {
command.genBuildConfig(
args,
counter);
} catch (AbortException ae) { }
} finally {
System.setErr(saveOut);
}
String text = byteArrayOut.toString();

assertTrue(
"version output",
outputWriter.getContents().indexOf("AspectJ Compiler") != -1);
text.indexOf("AspectJ Compiler") != -1);
}
public void testNonExistingLstFile() {

+ 42
- 36
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java View File

@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.aspectj.ajdt.internal.core.builder.*;
import org.aspectj.bridge.CountingMessageHandler;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.bridge.MessageWriter;
import org.aspectj.testing.util.TestUtil;
import org.eclipse.jdt.core.compiler.InvalidInputException;
@@ -30,20 +31,24 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
*/
public class BuildArgParserTestCase extends TestCase {

private BuildArgParser parser = new BuildArgParser();
private static final String TEST_DIR = AjdtAjcTests.TESTDATA_PATH + File.separator + "ajc" + File.separator;
private MessageWriter messageWriter = new MessageWriter(new PrintWriter(System.out), false);

public BuildArgParserTestCase(String name) {
super(name);
}
private AjBuildConfig genBuildConfig(String[] args, IMessageHandler handler) {
return new BuildArgParser(handler).genBuildConfig(args);
}

public void testDefaultClasspathAndTargetCombo() throws InvalidInputException {
String ENTRY = "1.jar;2.jar";
final String classpath = System.getProperty("java.class.path");
try {
System.setProperty("java.class.path", ENTRY); // see finally below
AjBuildConfig config = parser.genBuildConfig(new String[] { }, messageWriter);
BuildArgParser parser = new BuildArgParser(messageWriter);
AjBuildConfig config = parser.genBuildConfig(new String[] { });
String err = parser.getOtherMessages(true);
//!!!assertTrue(err, null == err);
assertTrue(
@@ -53,7 +58,7 @@ public class BuildArgParserTestCase extends TestCase {
config.getClasspath().toString(),
config.getClasspath().contains("2.jar"));
config = parser.genBuildConfig(new String[] { "-1.3" }, messageWriter);
config = genBuildConfig(new String[] { "-1.3" }, messageWriter);
// these errors are deffered to the compiler now
//err = parser.getOtherMessages(true);
//!!!assertTrue(err, null == err);
@@ -64,7 +69,8 @@ public class BuildArgParserTestCase extends TestCase {
config.getClasspath().toString(),
config.getClasspath().contains("2.jar"));
config = parser.genBuildConfig(new String[] { "-1.3" }, messageWriter);
parser = new BuildArgParser(messageWriter);
config = parser.genBuildConfig(new String[] { "-1.3" });
err = parser.getOtherMessages(true);
//!!!assertTrue(err, null == err);
assertTrue(
@@ -74,7 +80,7 @@ public class BuildArgParserTestCase extends TestCase {
config.getClasspath().toString(),
config.getClasspath().contains("2.jar"));
config = parser.genBuildConfig(new String[] {
config = genBuildConfig(new String[] {
"-classpath", ENTRY, "-1.4" }, messageWriter);
// these errors are deffered to the compiler now
//err = parser.getOtherMessages(true);
@@ -96,7 +102,7 @@ public class BuildArgParserTestCase extends TestCase {
}
public void testAjOptions() throws InvalidInputException {
AjBuildConfig config = parser.genBuildConfig(new String[] { "-Xlint" }, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] { "-Xlint" }, messageWriter);
assertTrue(
"default options",
@@ -109,13 +115,13 @@ public class BuildArgParserTestCase extends TestCase {
final String SOURCE_JARS = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar" + File.pathSeparator
+ "../weaver/testdata/tracing.jar" + File.pathSeparator
+ "../weaver/testdata/dummyAspect.jar";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-aspectpath", SOURCE_JAR },
messageWriter);
assertTrue(((File)config.getAspectpath().get(0)).getName(), ((File)config.getAspectpath().get(0)).getName().equals("testclasses.jar"));

config = parser.genBuildConfig(new String[] {
config = genBuildConfig(new String[] {
"-aspectpath", SOURCE_JARS },
messageWriter);
assertTrue("size", + config.getAspectpath().size() == 3);
@@ -126,7 +132,7 @@ public class BuildArgParserTestCase extends TestCase {
final String SOURCE_JARS = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar" + File.pathSeparator
+ "../weaver/testdata/tracing.jar" + File.pathSeparator
+ "../weaver/testdata/dummyAspect.jar";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-injars", SOURCE_JAR },
messageWriter);
//XXX don't let this remain in both places in beta1
@@ -135,7 +141,7 @@ public class BuildArgParserTestCase extends TestCase {
config.getAjOptions().get(AjCompilerOptions.OPTION_InJARs).equals(CompilerOptions.PRESERVE));
assertTrue(((File)config.getInJars().get(0)).getName(), ((File)config.getInJars().get(0)).getName().equals("testclasses.jar"));

config = parser.genBuildConfig(new String[] {
config = genBuildConfig(new String[] {
"-injars", SOURCE_JARS },
messageWriter);
assertTrue("size", + config.getInJars().size() == 3);
@@ -143,7 +149,7 @@ public class BuildArgParserTestCase extends TestCase {

public void testBadInJars() throws InvalidInputException {
final String SOURCE_JARS = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar" + File.pathSeparator + "b.far" + File.pathSeparator + "c.jar";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-injars", SOURCE_JARS },
messageWriter);
assertTrue("size: " + config.getInJars().size(), config.getInJars().size() == 1);
@@ -151,14 +157,14 @@ public class BuildArgParserTestCase extends TestCase {

public void testBadPathToSourceFiles() {
CountingMessageHandler countingHandler = new CountingMessageHandler(messageWriter);
AjBuildConfig config = parser.genBuildConfig(new String[]{ "inventedDir/doesntexist/*.java"},countingHandler);
AjBuildConfig config = genBuildConfig(new String[]{ "inventedDir/doesntexist/*.java"},countingHandler);
assertTrue("Expected an error for the invalid path.",countingHandler.numMessages(IMessage.ERROR,false)==1);
}

public void testMultipleSourceRoots() throws InvalidInputException, IOException {
final String SRCROOT_1 = AjdtAjcTests.TESTDATA_PATH + "/src1/p1";
final String SRCROOT_2 = AjdtAjcTests.TESTDATA_PATH + "/ajc";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-sourceroots", SRCROOT_1 + File.pathSeparator + SRCROOT_2 },
messageWriter);
@@ -195,7 +201,7 @@ public class BuildArgParserTestCase extends TestCase {

public void testSourceRootDir() throws InvalidInputException, IOException {
final String SRCROOT = AjdtAjcTests.TESTDATA_PATH + "/ajc";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-sourceroots", SRCROOT },
messageWriter);

@@ -215,7 +221,7 @@ public class BuildArgParserTestCase extends TestCase {
}

public void testBadSourceRootDir() throws InvalidInputException {
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-sourceroots",
AjdtAjcTests.TESTDATA_PATH + "/mumbleDoesNotExist;"
+ AjdtAjcTests.TESTDATA_PATH + "/ajc" },
@@ -223,7 +229,7 @@ public class BuildArgParserTestCase extends TestCase {

assertTrue(config.getSourceRoots().toString(), config.getSourceRoots().size() == 1);

config = parser.genBuildConfig(new String[] {
config = genBuildConfig(new String[] {
"-sourceroots" },
messageWriter);

@@ -234,7 +240,7 @@ public class BuildArgParserTestCase extends TestCase {
//??? we've decided not to make this an error
public void testSourceRootDirWithFiles() throws InvalidInputException, IOException {
final String SRCROOT = AjdtAjcTests.TESTDATA_PATH + "/ajc/pkg";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-sourceroots", SRCROOT, AjdtAjcTests.TESTDATA_PATH + "/src1/A.java"},
messageWriter);

@@ -251,7 +257,7 @@ public class BuildArgParserTestCase extends TestCase {

public void testExtDirs() throws InvalidInputException {
final String DIR = AjdtAjcTests.TESTDATA_PATH;
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-extdirs", DIR },
messageWriter);
assertTrue(config.getClasspath().toString(), config.getClasspath().contains(
@@ -261,12 +267,12 @@ public class BuildArgParserTestCase extends TestCase {

public void testBootclasspath() throws InvalidInputException {
final String PATH = "mumble/rt.jar";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-bootclasspath", PATH },
messageWriter);
assertTrue(config.getClasspath().toString(), config.getClasspath().get(0).equals(PATH));

config = parser.genBuildConfig(new String[] {
config = genBuildConfig(new String[] {
},
messageWriter);
assertTrue(config.getClasspath().toString(), !config.getClasspath().get(0).equals(PATH));
@@ -275,7 +281,7 @@ public class BuildArgParserTestCase extends TestCase {
public void testOutputJar() throws InvalidInputException {
final String OUT_JAR = AjdtAjcTests.TESTDATA_PATH + "/testclasses.jar";
AjBuildConfig config = parser.genBuildConfig(new String[] {
AjBuildConfig config = genBuildConfig(new String[] {
"-outjar", OUT_JAR },
messageWriter);

@@ -287,7 +293,7 @@ public class BuildArgParserTestCase extends TestCase {
getCanonicalPath(new File(OUT_JAR)),config.getOutputJar().getAbsolutePath());
File nonExistingJar = new File(AjdtAjcTests.TESTDATA_PATH + "/mumbleDoesNotExist.jar");
config = parser.genBuildConfig(new String[] {
config = genBuildConfig(new String[] {
"-outjar", nonExistingJar.getAbsolutePath() },
messageWriter);
assertEquals(
@@ -299,7 +305,7 @@ public class BuildArgParserTestCase extends TestCase {
//XXX shouldn't need -1.4 to get this to pass
public void testCombinedOptions() throws InvalidInputException {
AjBuildConfig config = parser.genBuildConfig(new String[] { "-Xlint", "-target", "1.4", "-1.4" }, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] { "-Xlint", "-target", "1.4", "-1.4" }, messageWriter);
String TARGET = "1.4";
assertTrue(
"target set",
@@ -312,7 +318,7 @@ public class BuildArgParserTestCase extends TestCase {
}
public void testOutputDirectorySetting() throws InvalidInputException {
AjBuildConfig config = parser.genBuildConfig(new String[] { "-d", TEST_DIR }, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] { "-d", TEST_DIR }, messageWriter);
assertTrue(
new File(config.getOutputDir().getPath()).getAbsolutePath() + " ?= " +
@@ -322,7 +328,7 @@ public class BuildArgParserTestCase extends TestCase {

public void testClasspathSetting() throws InvalidInputException {
String ENTRY = "1.jar;2.jar";
AjBuildConfig config = parser.genBuildConfig(new String[] { "-classpath", ENTRY }, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] { "-classpath", ENTRY }, messageWriter);
assertTrue(
config.getClasspath().toString(),
@@ -336,7 +342,7 @@ public class BuildArgParserTestCase extends TestCase {
public void testArgInConfigFile() throws InvalidInputException {
String FILE_PATH = "@" + TEST_DIR + "configWithArgs.lst";
String OUT_PATH = "bin";
AjBuildConfig config = parser.genBuildConfig(new String[] { FILE_PATH }, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] { FILE_PATH }, messageWriter);
assertNotNull(config);
File outputDir = config.getOutputDir();
@@ -346,7 +352,7 @@ public class BuildArgParserTestCase extends TestCase {

public void testNonExistentConfigFile() throws IOException {
String FILE_PATH = "@" + TEST_DIR + "../bug-40257/d1/test.lst";
AjBuildConfig config = parser.genBuildConfig(new String[] { FILE_PATH }, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] { FILE_PATH }, messageWriter);

String a = new File(TEST_DIR + "../bug-40257/d1/A.java").getCanonicalPath();
String b = new File(TEST_DIR + "../bug-40257/d1/d2/B.java").getCanonicalPath();
@@ -363,20 +369,20 @@ public class BuildArgParserTestCase extends TestCase {

public void testXlint() throws InvalidInputException {
AjdtCommand command = new AjdtCommand();
AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlint"}, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] {"-Xlint"}, messageWriter);
assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_DEFAULT));
config = parser.genBuildConfig(new String[] {"-Xlint:warn"}, messageWriter);
config = genBuildConfig(new String[] {"-Xlint:warn"}, messageWriter);
assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_WARN));
config = parser.genBuildConfig(new String[] {"-Xlint:error"}, messageWriter);
config = genBuildConfig(new String[] {"-Xlint:error"}, messageWriter);
assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_ERROR));
config = parser.genBuildConfig(new String[] {"-Xlint:ignore"}, messageWriter);
config = genBuildConfig(new String[] {"-Xlint:ignore"}, messageWriter);
assertTrue("", config.getLintMode().equals(AjBuildConfig.AJLINT_IGNORE));
}

public void testXlintfile() throws InvalidInputException {
String lintFile = AjdtAjcTests.TESTDATA_PATH + "/lintspec.properties";
String badLintFile = "lint.props";
AjBuildConfig config = parser.genBuildConfig(new String[] {"-Xlintfile", lintFile}, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] {"-Xlintfile", lintFile}, messageWriter);
assertTrue(new File(lintFile).exists());
assertEquals(getCanonicalPath(new File(lintFile)),config.getLintSpecFile().getAbsolutePath());
}
@@ -384,7 +390,7 @@ public class BuildArgParserTestCase extends TestCase {
public void testOptions() throws InvalidInputException {
AjdtCommand command = new AjdtCommand();
String TARGET = "1.4";
AjBuildConfig config = parser.genBuildConfig(new String[] {"-target", TARGET, "-source", TARGET}, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] {"-target", TARGET, "-source", TARGET}, messageWriter);
assertTrue(
"target set",
config.getJavaOptions().get(CompilerOptions.OPTION_TargetPlatform).equals(TARGET));
@@ -400,7 +406,7 @@ public class BuildArgParserTestCase extends TestCase {

File f = new File(FILE_PATH);
AjBuildConfig config = parser.genBuildConfig(new String[] { "@" + FILE_PATH }, messageWriter);
AjBuildConfig config = genBuildConfig(new String[] { "@" + FILE_PATH }, messageWriter);
List resultList = config.getFiles();
assertTrue("correct number of files", resultList.size() == 2);
@@ -415,7 +421,7 @@ public class BuildArgParserTestCase extends TestCase {
// public void testArgInConfigFileAndRelativizingPathParam() throws InvalidInputException {
// String FILE_PATH = "@" + TEST_DIR + "configWithArgs.lst";
// String OUT_PATH = TEST_DIR + "bin";
// AjBuildConfig config = parser.genBuildConfig(new String[] { FILE_PATH });
// AjBuildConfig config = genBuildConfig(new String[] { FILE_PATH });
//
// assertTrue(
// config.getOutputDir().getPath() + " ?= " + OUT_PATH,
@@ -423,7 +429,7 @@ public class BuildArgParserTestCase extends TestCase {
// }
public void testAjFileInclusion() throws InvalidInputException {
parser.genBuildConfig(new String[] { TEST_DIR + "X.aj", TEST_DIR + "Y.aj"}, messageWriter);
genBuildConfig(new String[] { TEST_DIR + "X.aj", TEST_DIR + "Y.aj"}, messageWriter);
}
protected void setUp() throws Exception {

+ 2
- 2
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AjBuildManagerTest.java View File

@@ -62,7 +62,7 @@ public class AjBuildManagerTest extends TestCase {
public void testSimpleStructure() throws IOException, CoreException {
AjBuildManager manager = new AjBuildManager(messageWriter);
BuildArgParser parser = new BuildArgParser();
BuildArgParser parser = new BuildArgParser(messageWriter);
String javaClassPath = System.getProperty("java.class.path");
AjBuildConfig buildConfig =
parser.genBuildConfig(new String[] {
@@ -72,7 +72,7 @@ public class AjBuildManagerTest extends TestCase {
AjdtAjcTests.TESTDATA_PATH
+ "/src1/A.java",
// EajcModuleTests.TESTDATA_PATH + "/src1/Hello.java",
}, messageWriter);
});
String err = parser.getOtherMessages(true);
assertTrue(err, null == err);
manager.setStructureModel(AsmManager.getDefault().getHierarchy());

+ 2
- 2
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/core/builder/AsmBuilderTest.java View File

@@ -19,7 +19,7 @@ import java.util.EmptyStackException;
import junit.framework.*;

import org.eclipse.jdt.internal.compiler.CompilationResult;
import org.eclipse.jdt.internal.compiler.ast.LocalTypeDeclaration;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.eclipse.jdt.internal.compiler.env.*;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;

@@ -55,7 +55,7 @@ public class AsmBuilderTest extends TestCase {
}
};
LocalTypeDeclaration local = new LocalTypeDeclaration(new CompilationResult(cu, 0, 0, 0));
TypeDeclaration local = new TypeDeclaration(new CompilationResult(cu, 0, 0, 0));
local.name = new char[2];
BlockScope scope = null;

BIN
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip View File


BIN
org.eclipse.jdt.core/jdtcore-for-aspectj.jar View File


+ 1
- 1
taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java View File

@@ -505,7 +505,7 @@ public class AjcTask extends MatchingTask {
}

public void setNoImportError(boolean noImportError) {
cmd.addFlag("-noImportError", noImportError);
cmd.addFlag("-warn:-unusedImport", noImportError);
}

public void setEncoding(String encoding) {

+ 79
- 35
tests/ajcTests.xml View File

@@ -30,6 +30,9 @@
knownLimitation-ajdeCompiler
Accepted limitation of the AJDE CompileCommand wrapper
poorErrorMessages test case passes but errors produced by compiler could do with
improvement
Test titles:
Titles should be unique and not change, and related tests should have the
@@ -1088,7 +1091,7 @@
</ajc-test>

<ajc-test dir="new" title="Error expected for constructor in interfaces"
keywords="from-java">
keywords="from-java,purejava">
<compile files="InterfaceConstructor.java">
<message kind="error" line="2"/>
<message kind="error" line="6"/>
@@ -1572,7 +1575,6 @@
keywords="from-errors">
<compile files="MismatchedParens.java">
<message kind="error" line="16"/>
<message kind="error" line="17"/>
</compile>
</ajc-test>

@@ -1585,7 +1587,7 @@

<ajc-test dir="errors" pr="218"
title="import statement within class body crashes compiler"
keywords="from-errors">
keywords="from-errors,purejava">
<compile files="ImportWithinClassBody.java">
<message kind="error" line="8"/>
</compile>
@@ -1594,8 +1596,7 @@
<ajc-test dir="errors" pr="219" title="extra closing brace"
keywords="from-errors">
<compile files="ExtraClosingBrace.java">
<message kind="error" line="9"/>
<message kind="error" line="10"/>
<message kind="error" line="8"/>
</compile>
</ajc-test>

@@ -1642,7 +1643,7 @@
<ajc-test dir="errors" pr="280" title="wildcard used for returns clause"
keywords="from-errors">
<compile files="WildcardForReturns.java">
<message kind="error" line="17"/>
<message kind="error" line="17"/>
</compile>
</ajc-test>

@@ -1776,7 +1777,7 @@
title="pre 0.7 introduction form outside aspect body causes an EmptyStackException"
keywords="from-errors">
<compile files="BadIntroduction.java">
<message kind="error" line="10"/>
<message kind="error" line="3"/>
</compile>
</ajc-test>

@@ -1791,7 +1792,7 @@
title="a before() clause at the class-level causes an EmptyStackException"
keywords="from-errors">
<compile files="TopLevelBefore.java">
<message kind="error" line="9"/>
<message kind="error" line="3"/>
</compile>
</ajc-test>

@@ -1799,7 +1800,7 @@
title="an after() clause at the class-level causes an EmptyStackException"
keywords="from-errors">
<compile files="TopLevelAfter.java">
<message kind="error" line="9"/>
<message kind="error" line="3"/>
</compile>
</ajc-test>

@@ -1807,7 +1808,7 @@
title="an around() clause at the class-level causes an EmptyStackException"
keywords="from-errors">
<compile files="TopLevelAround.java">
<message kind="error" line="9"/>
<message kind="error" line="3"/>
</compile>
</ajc-test>

@@ -2288,11 +2289,14 @@

<ajc-test dir="new" pr="457"
title="Compiler should suggest using aspect when advice, pointcuts, or introduction is in a class"
keywords="from-errors">
keywords="from-errors,poorErrorMessages">
<compile files="RecognizeAspectCE.java">
<message kind="error" line="3"
file="RecognizeAspectCE.java"
text="Syntax error"/>
<message kind="error" line="6"
file="RecognizeAspectCE.java"
text="Syntax error on token"/>
text="Syntax error"/>
</compile>
</ajc-test>

@@ -3115,7 +3119,8 @@
<run class="NewAnonymous"/>
</ajc-test>

<ajc-test dir="new" title="Cannot bind a name." keywords="from-resolved_10x">
<ajc-test dir="new"
title="Cannot bind a name." keywords="from-resolved_10x,purejava">
<compile files="CannotReferenceSuper.java"/>
<run class="CannotReferenceSuper"/>
</ajc-test>
@@ -3298,10 +3303,17 @@
<ajc-test dir="new"
title="around advice on calls within inner classes (including protected method calls)"
keywords="from-resolved_10x">
<compile files="AroundInnerCalls.java"/>
<run class="AroundInnerCalls"/>
<compile files="AroundInnerCalls13.java" options="-1.3"/>
<run class="AroundInnerCalls13"/>
</ajc-test>

<ajc-test dir="new"
title="around advice on calls within inner classes (including protected method calls)"
keywords="from-resolved_10x">
<compile files="AroundInnerCalls.java" options="-1.4"/>
<run class="AroundInnerCalls"/>
</ajc-test>
<ajc-test dir="new" title="Arguments to runNext should be final when needed"
keywords="from-resolved_10x">
<compile files="Finals.java"/>
@@ -3380,13 +3392,13 @@
<run class="EmptyStack"/>
</ajc-test>

<ajc-test dir="new"
title="check that MightHaveAspect interface is created correctly for an aspect in deep package"
keywords="from-resolved_10x">
<compile files="EachObjectTarget.java,EachObjectInDeepPackage.java"/>
<run class="EachObjectTarget"/>
</ajc-test>
<ajc-test dir="new/perThis"
title="check that MightHaveAspect interface is created correctly for an aspect in deep package"
keywords="from-resolved_10x">
<compile files="p/EachObjectTarget.java,the/deep/pkg/EachObjectInDeepPackage.java"/>
<run class="p.EachObjectTarget"/>
</ajc-test>
<ajc-test dir="new" title="Defines clfow$ajc0 more once. [eachcflow]"
keywords="from-resolved_10x">
<compile files="Binkley.java"/>
@@ -4433,7 +4445,7 @@
<ajc-test dir="new"
title="changing this in around's proceed reported by Rich Price"
keywords="from-resolved_104">
<compile files="AroundChangeThis.java"/>
<compile files="AroundChangeThis.java" options="-1.4"/>
<run class="AroundChangeThis"/>
</ajc-test>

@@ -5213,17 +5225,17 @@

<!-- .................................... option tests -->
<!-- .................................... -warn tests -->
<ajc-test dir="options"
<ajc-test dir="options/deprecated"
title="options -warn:deprecation">
<compile files="WarnDeprecated.java"
<compile files="WarnDeprecated.java,OldStuff.java"
options="!eclipse,-warn:deprecation">
<message kind="warning" line="10"/>
</compile>
</ajc-test>
<ajc-test dir="options"
<ajc-test dir="options/deprecated"
title="options -warn:deprecation not enabled">
<compile files="WarnDeprecated.java"
<compile files="WarnDeprecated.java,OldStuff.java"
options="!eclipse">
</compile>
</ajc-test>
@@ -5350,7 +5362,7 @@
<ajc-test dir="new" title="expect CE for unterminated declare error">
<compile files="UnterminatedDeclareErrorCE.java">
<message kind="error" line="5"/>
<message kind="error" line="4"/>
</compile>
</ajc-test>
@@ -6777,13 +6789,18 @@
</ajc-test>
<ajc-test dir="bugs/concretizeNpe" pr="43033"
title="NPE in concretization error path">
title="NPE in concretization error path"
keywords="poorErrorMessages">
<compile files="base/ExceptionHandling.java,model/ModelExceptionHandling.java">
<!--
<message line="5" kind="error" text="pointcut base.ExceptionHandling.scope() is abstract"/>
<message line="4" kind="error" text="inherited abstract pointcut base.ExceptionHandling.scope() is not made concrete"/>
<message line="8" kind="error" text="inherited abstract pointcut base.ExceptionHandling.scope() is not made concrete"/>
<message line="12" kind="error" text="Unmatched bracket"/>
<message line="13" kind="error" text="Syntax error on token"/>
<message line="12" kind="error" />
<message line="13" kind="error" />
-->
<message line="12" kind="error" />
<message line="13" kind="error" />
</compile>
</ajc-test>

@@ -6862,7 +6879,8 @@
pr="41952"
>
<compile
files="DeclaringTypeWarning.java" >
files="DeclaringTypeWarning.java"
options="-1.3" >
<message kind="warning" line="6" text="declaring type">
<source line="12" file="DeclaringTypeWarning.java" />
</message>
@@ -6872,16 +6890,27 @@
</compile>
</ajc-test>

<ajc-test dir="bugs"
title="XLint warning for call PCD's using subtype of defining type (-1.3 -Xlint:ignore)"
pr="41952"
>
<compile
options="-Xlint:ignore,-1.3"
files="DeclaringTypeWarning.java" >
</compile>
</ajc-test>
<ajc-test dir="bugs"
title="XLint warning for call PCD's using subtype of defining type (-Xlint:ignore)"
title="XLint warning for call PCD's using subtype of defining type (-1.4 -Xlint:ignore)"
pr="41952"
>
<compile
options="-Xlint:ignore"
options="-Xlint:ignore,-1.4"
files="DeclaringTypeWarning.java" >
<message kind="warning" line="12"/>
</compile>
</ajc-test>

<ajc-test dir="bugs"
title="XLint warning for call PCD's using subtype of defining type (-1.4)"
pr="41952"
@@ -6920,4 +6949,19 @@
<compile files="TestSoftening.java">
</compile>
</ajc-test>
<ajc-test dir="bugs" pr="45663"
title="Bad parser error recovery in advice">
<compile files="ParserRecoveryTest.java">
<message kind="error" line="7"/>
</compile>
</ajc-test>
<ajc-test dir="bugs" pr="45663"
title="Bad parser error recovery in java source">
<compile files="ParserRecoveryTestPureJava.java">
<message kind="error" line="6"/>
<message kind="error" line="8"/>
</compile>
</ajc-test>
</suite>

+ 8
- 0
tests/bugs/ParserRecoveryTest.java View File

@@ -0,0 +1,8 @@
// pr 45663
aspect ParserRecoveryTest1
{
pointcut s(int x):
execution(* fred(x));

after(int xxx x x x x): this(*) {}
}

+ 9
- 0
tests/bugs/ParserRecoveryTestPureJava.java View File

@@ -0,0 +1,9 @@
// pr 45663
abstract class ParserRecoveryTestPureJava
{
abstract int s(int x);

void after(int xxx x x x x) {}
void m() { return 2;}
}

+ 3
- 2
tests/errors/BadIntroduction.java View File

@@ -1,5 +1,7 @@
import org.aspectj.testing.Tester;

introduction (String) {}

public class BadIntroduction {
public static void main(String[] args) {
String s;
@@ -7,5 +9,4 @@ public class BadIntroduction {
}
}

introduction (String) {
}


+ 2
- 4
tests/errors/BadIntroductionDesignator.java View File

@@ -2,10 +2,8 @@ package errors;

// PR#129

public class BadIntroductionDesignator {
introduction (M||) {
public boolean m_foo;
}
public aspect BadIntroductionDesignator {
public boolean (M||).m_foo;
}

class M {}

+ 1
- 3
tests/errors/ExtraClosingBrace.java View File

@@ -5,6 +5,4 @@ package errors;
public aspect ExtraClosingBrace {
public void doIt() {
}}
}
}
}}}}

+ 3
- 4
tests/errors/NoAspect.java View File

@@ -7,8 +7,7 @@ public class NoAspect {
}
}

class A {
static pointcut p(): target(*) && call(* go(..));
before(): p() {
}

class A
{ before(): target(*) && call(* go(..)) {}
}

+ 1
- 3
tests/errors/NoSource.java View File

@@ -1,7 +1,5 @@
import org.aspectj.testing.Tester;

class NoSource {
introduction String {
public void foo() {}
}
public void String.foo() {}
}

+ 2
- 1
tests/errors/TopLevelAfter.java View File

@@ -1,9 +1,10 @@
import org.aspectj.testing.Tester;

after(): call(void main(..)) {} // CE 3

public class TopLevelAfter {
public static void main(String[] args) {
Tester.check(false, "should not have compiled");
}
}

after(): {}

+ 3
- 2
tests/errors/TopLevelAround.java View File

@@ -1,9 +1,10 @@
import org.aspectj.testing.Tester;

public class TopLevelAround {
void around(): call(void main(..)) {} // CE 3

public aspect TopLevelAround {
public static void main(String[] args) {
Tester.check(false, "should not have compiled");
}
}

around(): {} // CE 9

+ 2
- 2
tests/errors/TopLevelBefore.java View File

@@ -1,9 +1,9 @@
import org.aspectj.testing.Tester;

before(): call(void main(..)) {} // CE 3

public class TopLevelBefore {
public static void main(String[] args) {
Tester.check(false, "should not have compiled");
}
}

before(): {}

+ 6
- 7
tests/errors/WildcardForReturns.java View File

@@ -11,11 +11,10 @@ public class WildcardForReturns {
new WildcardForReturns().m();
}
public void m() { }

static aspect A {
* around (WildcardForReturns t): this(t) && call(* m()) { // CE 17
// bad test - return null; //return proceed(t);
}
}
public void m() { }
}
aspect A {
* around (WildcardForReturns t): this(t) && call(* m()) { // CE 17
// bad test - return null; //return proceed(t);
}
}

+ 13
- 5
tests/new/AroundChangeThis.java View File

@@ -12,15 +12,23 @@ public class AroundChangeThis {
c1.m(sc);
Tester.checkAndClearEvents(new String[] { "c1.m(sc)", "sc.m(c1)" });

sc.m(c1);
Tester.checkAndClearEvents(new String[] { "sc.m(c1)", "c1.m(sc)" });

// this is the 1.3 behaviour
// sc.m(c1);
// Tester.checkAndClearEvents(new String[] { "sc.m(c1)", "c1.m(sc)" });

try {
// the 1.4 behaviour is....
// in byte code we have a call to SubC.m
sc.m(c1);
Tester.checkFailed("Expected ClassCastException");
} catch (ClassCastException e) {
}
try {
sc.m1(c1);
Tester.checkFailed("Expected ClassCastException");
} catch (ClassCastException e) {
Tester.event("ClassCastException");
}
Tester.checkAndClearEvents(new String[] { "ClassCastException" });

Tester.printEvents();
}

+ 3
- 3
tests/new/AroundInnerCalls.java View File

@@ -6,11 +6,11 @@ public class AroundInnerCalls {

Tester.check("Outer.foo() calls Outer.Inner.mi()");
Tester.check("Outer.foo() calls Outer.InnerRandom.nextHook(..)");
Tester.check("Outer.InnerRandom.nextHook(..) calls Random.next(..)");
Tester.check("Outer.InnerRandom.nextHook(..) calls Outer.InnerRandom.next(..)");
Tester.check("Outer.Inner.mi() calls PrintStream.println(..)");

Tester.check("X.toString()");
Tester.check("Outer.foo() calls Random.nextInt(..)");
Tester.check("Outer.foo() calls Outer.1.nextInt(..)");
}
}

@@ -37,7 +37,7 @@ class Outer {

aspect A {
Object around(): call(* *(..)) && !within(A) {
//System.out.println
// System.out.println
Tester.note
(thisEnclosingJoinPointStaticPart.getSignature().toShortString() +
" calls " + thisJoinPointStaticPart.getSignature().toShortString());

+ 56
- 0
tests/new/AroundInnerCalls13.java View File

@@ -0,0 +1,56 @@
import org.aspectj.testing.Tester;

public class AroundInnerCalls13 {
public static void main(String[] args) {
new Outer().foo();

Tester.check("Outer.foo() calls Outer.Inner.mi()");
Tester.check("Outer.foo() calls Outer.InnerRandom.nextHook(..)");
Tester.check("Outer.InnerRandom.nextHook(..) calls Random.next(..)");
Tester.check("Outer.Inner.mi() calls PrintStream.println(..)");

Tester.check("X.toString()");
Tester.check("Outer.foo() calls Random.nextInt(..)");
}
}

class Outer {
private class Inner extends Object {
public void mi() {
System.out.println(".");
}
}

public void foo() {
new Inner().mi();
new InnerRandom().nextHook(2);

new java.util.Random() { public String toString() { Tester.note("X.toString()"); return "X"; } }.nextInt(2);
}

private class InnerRandom extends java.util.Random {
public int nextHook(int bits) {
return next(bits);
}
}
}

aspect A {
Object around(): call(* *(..)) && !within(A) {
// System.out.println
Tester.note
(thisEnclosingJoinPointStaticPart.getSignature().toShortString() +
" calls " + thisJoinPointStaticPart.getSignature().toShortString());
return proceed();
}
before(Object caller, Object callee):
this(caller) && target(callee) && call(* *(..)) && !within(A)
{
System.out.println(thisEnclosingJoinPointStaticPart.getSignature().toShortString() +
" calls " + thisJoinPointStaticPart.getSignature().toShortString());
System.out.println
(caller + "." + thisEnclosingJoinPointStaticPart.getSignature().getName() +
" calls " + callee + "." + thisJoinPoint.getSignature().getName());
}
}

+ 1
- 2
tests/new/DeclareMethodCE.java View File

@@ -5,7 +5,6 @@ class B {}

aspect A {
void B.n() {
void n() { // CE 8 method declared in method
}
void n() { } // CE 8 method declared in method
}
}

+ 1
- 1
tests/new/InterfaceConstructor.java View File

@@ -3,7 +3,7 @@ interface i {
}

class c {
c(); //ERR: constructors must have bodies
c(); //ERR: constructors must have bodies

abstract c(int i) { } //ERR: constructors can't be abstract
}

+ 3
- 3
tests/new/RecognizeAspectCE.java View File

@@ -1,7 +1,7 @@
// PR#457
class RecognizeAspectCE {
public static void main(String[] ignore) { }
pointcut mumble() // would like error here: "pointcuts not allowed in classes - use aspect"
: execution(public static void RecognizeAspectCE.main(String[]));
before(): mumble() { } // ok: get error here: constructor has the wrong name
// pointcut mumble()
// : execution(public static void RecognizeAspectCE.main(String[]));
before(): this(*) { } // ok: get error here: constructor has the wrong name
}

+ 13
- 0
tests/new/perThis/p/EachObjectTarget.java View File

@@ -0,0 +1,13 @@
package p;
import org.aspectj.testing.Tester;

public class EachObjectTarget {
public static void main(String[] args) {
EachObjectTarget o = new EachObjectTarget();
o.foo();
}
void foo() {
Tester.check(true, "Dummy test");
}
}

+ 11
- 0
tests/new/perThis/the/deep/pkg/EachObjectInDeepPackage.java View File

@@ -0,0 +1,11 @@
package the.deep.pkg;

import org.aspectj.testing.Tester;
import p.EachObjectTarget;

aspect Aspect pertarget(target(EachObjectTarget)) {
before(): call(void foo(..)) {
EachObjectTarget t = null;
Tester.check(true, "Dummy test");
}
}

+ 0
- 13
tests/options/WarnDeprecated.java View File

@@ -1,13 +0,0 @@




public class WarnDeprecated {

/** */
public static void main(String[] args) {
if (null == args) {
String s = new String(new byte[] {}, 0); // CE 10 deprecated if warn:deprecated
}
}
}

+ 8
- 0
tests/options/deprecated/OldStuff.java View File

@@ -0,0 +1,8 @@
class OldStuff {

/**
* @deprecated
*/
public static void foo() {}
}

+ 18
- 0
tests/options/deprecated/WarnDeprecated.java View File

@@ -0,0 +1,18 @@




public class WarnDeprecated {

/** */
public static void main(String[] args) {
if (null == args) {
OldStuff.foo(); // CE 10 deprecated if warn:deprecated
// This is only picked up as a deprecation error when compiling against developer
// libraries, it will be ignored if compiling against the user jre libraries.
// We're not going to include this in the test suite for robustness of the suite.
//"hello".getBytes(0, 1, new byte[10], 0);
}
}
}

Loading…
Cancel
Save