Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 152688 Details for
Bug 288211
APT uses a lot of memory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch for 3.5 maintenance stream
patch3.txt (text/plain), 23.73 KB, created by
Satyam Kandula
on 2009-11-20 04:57:46 EST
(
hide
)
Description:
Proposed patch for 3.5 maintenance stream
Filename:
MIME Type:
Creator:
Satyam Kandula
Created:
2009-11-20 04:57:46 EST
Size:
23.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.apt.core >Index: src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java,v >retrieving revision 1.34 >diff -u -r1.34 BaseProcessorEnv.java >--- src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java 2 Sep 2008 16:49:00 -0000 1.34 >+++ src/org/eclipse/jdt/apt/core/internal/env/BaseProcessorEnv.java 20 Nov 2009 09:39:45 -0000 >@@ -853,6 +853,7 @@ > p.setBindingsRecovery(true); > p.setProject( javaProject ); > p.setKind( ASTParser.K_COMPILATION_UNIT ); >+ p.ignoreMethodBodies(); > p.createASTs( parseUnits, keys, requestor, null); > } > >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java,v >retrieving revision 1.158.2.3 >diff -u -r1.158.2.3 TypeDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 1 Oct 2009 18:27:26 -0000 1.158.2.3 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java 20 Nov 2009 09:39:51 -0000 >@@ -491,6 +491,27 @@ > return null; > } > >+public void deleteMethodBodiesWithoutLocalTypes(Parser parser, CompilationUnitDeclaration unit) { >+ >+ //members >+ if (this.memberTypes != null) { >+ int length = this.memberTypes.length; >+ for (int i = 0; i < length; i++) { >+ TypeDeclaration typeDeclaration = this.memberTypes[i]; >+ typeDeclaration.deleteMethodBodiesWithoutLocalTypes(parser, unit); >+ } >+ } >+ >+ //methods >+ if (this.methods != null) { >+ int length = this.methods.length; >+ for (int i = 0; i < length; i++) { >+ AbstractMethodDeclaration abstractMethodDeclaration = this.methods[i]; >+ if ((abstractMethodDeclaration.bits & ASTNode.HasLocalType) == 0) >+ abstractMethodDeclaration.statements = null; >+ } >+ } >+} > /** > * Generic bytecode generation for type > */ >Index: dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java,v >retrieving revision 1.133.2.2 >diff -u -r1.133.2.2 CompilationUnitResolver.java >--- dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java 27 Aug 2009 14:52:51 -0000 1.133.2.2 >+++ dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java 20 Nov 2009 09:39:55 -0000 >@@ -359,8 +359,12 @@ > //real parse of the method.... > org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types; > if (types != null) { >- for (int j = 0, typeLength = types.length; j < typeLength; j++) >+ boolean ignoreMethodBodies = ((flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0)?true: false; >+ for (int j = 0, typeLength = types.length; j < typeLength; j++) { > types[j].parseMethods(parser, compilationUnitDeclaration); >+ if (ignoreMethodBodies) >+ types[j].deleteMethodBodiesWithoutLocalTypes(parser, compilationUnitDeclaration); >+ } > } > > // convert AST >@@ -431,13 +435,17 @@ > } > } > } else { >- //fill the methods bodies in order for the code to be generated >- //real parse of the method.... >- org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types; >- if (types != null) { >- for (int i = 0, length = types.length; i < length; i++) >- types[i].parseMethods(parser, compilationUnitDeclaration); >- } >+ //fill the methods bodies in order for the code to be generated >+ //real parse of the method.... >+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = compilationUnitDeclaration.types; >+ if (types != null) { >+ boolean ignoreMethodBodies = ((flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0)?true: false; >+ for (int j = 0, typeLength = types.length; j < typeLength; j++) { >+ types[j].parseMethods(parser, compilationUnitDeclaration); >+ if (ignoreMethodBodies) >+ types[j].deleteMethodBodiesWithoutLocalTypes(parser, compilationUnitDeclaration); >+ } >+ } > } > return compilationUnitDeclaration; > } >@@ -470,7 +478,7 @@ > getRequestor(), > problemFactory, > monitor); >- >+ if ((flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0) resolver.ignoreMethodBodies = true; > resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner, flags); > if (NameLookup.VERBOSE) { > System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ >@@ -513,15 +521,21 @@ > getRequestor(), > problemFactory, > monitor); >- >+ boolean analyzeCode = true; >+ boolean generateCode = true; >+ if ((flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0) { >+ resolver.ignoreMethodBodies = true; >+ analyzeCode = false; >+ generateCode = false; >+ } > unit = > resolver.resolve( > null, // no existing compilation unit declaration > sourceUnit, > nodeSearcher, > true, // method verification >- true, // analyze code >- true); // generate code >+ analyzeCode, // analyze code >+ generateCode); // generate code > if (resolver.hasCompilationAborted) { > // the bindings could not be resolved due to missing types in name environment > // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541 >@@ -820,7 +834,7 @@ > } > > if (nodeSearcher == null) { >- this.parser.getMethodBodies(unit); // no-op if method bodies have already been parsed >+ getMethodBodies(unit); // no-op if method bodies have already been parsed > } else { > int searchPosition = nodeSearcher.position; > char[] source = sourceUnit.getContents(); >Index: dom/org/eclipse/jdt/core/dom/ASTParser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java,v >retrieving revision 1.88 >diff -u -r1.88 ASTParser.java >--- dom/org/eclipse/jdt/core/dom/ASTParser.java 27 Apr 2009 08:46:43 -0000 1.88 >+++ dom/org/eclipse/jdt/core/dom/ASTParser.java 20 Nov 2009 09:39:54 -0000 >@@ -149,6 +149,10 @@ > private boolean statementsRecovery; > > /** >+ * Request to ignore parsing the method bodies. Defaults to <code>false</code>. >+ */ >+ private boolean ignoreMethodBodies; >+ /** > * Request for a bindings recovery. Defaults to <code>false</code>. > */ > private boolean bindingsRecovery; >@@ -226,6 +230,7 @@ > this.rawSource = null; > this.typeRoot = null; > this.resolveBindings = false; >+ this.ignoreMethodBodies = false; > this.sourceLength = -1; > this.sourceOffset = 0; > this.workingCopyOwner = DefaultWorkingCopyOwner.PRIMARY; >@@ -564,6 +569,19 @@ > public void setStatementsRecovery(boolean enabled) { > this.statementsRecovery = enabled; > } >+ >+ /** >+ * Requests an abstract syntax tree without method bodies. >+ * If this functions is called, even the code analysis and generation are not done. >+ * If the function has anonymous classes, the method bodies will be retained. >+ * This flag is honored only when the source is a compilation unit and the full >+ * AST is required. >+ * >+ * @since 3.5.2 >+ */ >+ public void ignoreMethodBodies() { >+ this.ignoreMethodBodies = true; >+ } > > /** > * Sets the working copy owner using when resolving bindings, where >@@ -730,6 +748,7 @@ > try { > int flags = 0; > if (this.statementsRecovery) flags |= ICompilationUnit.ENABLE_STATEMENTS_RECOVERY; >+ if (this.ignoreMethodBodies) flags |= ICompilationUnit.IGNORE_METHOD_BODIES; > if (this.resolveBindings) { > if (this.project == null) > throw new IllegalStateException("project not specified"); //$NON-NLS-1$ >@@ -790,6 +809,7 @@ > int flags = 0; > if (this.statementsRecovery) flags |= ICompilationUnit.ENABLE_STATEMENTS_RECOVERY; > if (this.bindingsRecovery) flags |= ICompilationUnit.ENABLE_BINDINGS_RECOVERY; >+ if (this.ignoreMethodBodies) flags |= ICompilationUnit.IGNORE_METHOD_BODIES; > return CompilationUnitResolver.resolve(elements, this.apiLevel, this.compilerOptions, this.project, this.workingCopyOwner, flags, monitor); > } finally { > // re-init defaults to allow reuse (and avoid leaking) >@@ -900,6 +920,7 @@ > } > int flags = 0; > if (this.statementsRecovery) flags |= ICompilationUnit.ENABLE_STATEMENTS_RECOVERY; >+ if (searcher == null && this.ignoreMethodBodies) flags |= ICompilationUnit.IGNORE_METHOD_BODIES; > if (needToResolveBindings) { > if (this.bindingsRecovery) flags |= ICompilationUnit.ENABLE_BINDINGS_RECOVERY; > try { >Index: model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java,v >retrieving revision 1.63 >diff -u -r1.63 CompilationUnitProblemFinder.java >--- model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java 27 Jun 2008 16:03:50 -0000 1.63 >+++ model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java 20 Nov 2009 09:39:57 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -163,6 +163,13 @@ > getCompilerOptions(project.getOptions(true), creatingAST, ((reconcileFlags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0)), > getRequestor(), > problemFactory); >+ boolean analyzeCode = true; >+ boolean generateCode = true; >+ if ((reconcileFlags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0) { >+ problemFinder.ignoreMethodBodies = true; >+ analyzeCode = false; >+ generateCode = false; >+ } > CompilationUnitDeclaration unit = null; > if (parser != null) { > problemFinder.parser = parser; >@@ -172,8 +179,8 @@ > unit, > unitElement, > true, // verify methods >- true, // analyze code >- true); // generate code >+ analyzeCode, // analyze code >+ generateCode); // generate code > } catch (AbortCompilation e) { > problemFinder.handleInternalException(e, unit); > } >@@ -182,8 +189,8 @@ > problemFinder.resolve( > unitElement, > true, // verify methods >- true, // analyze code >- true); // generate code >+ analyzeCode, // analyze code >+ generateCode); // generate code > } > CompilationResult unitResult = unit.compilationResult; > CategorizedProblem[] unitProblems = unitResult.getProblems(); >Index: model/org/eclipse/jdt/core/compiler/ReconcileContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java,v >retrieving revision 1.14 >diff -u -r1.14 ReconcileContext.java >--- model/org/eclipse/jdt/core/compiler/ReconcileContext.java 1 Sep 2008 08:40:58 -0000 1.14 >+++ model/org/eclipse/jdt/core/compiler/ReconcileContext.java 20 Nov 2009 09:39:56 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -94,6 +94,8 @@ > parser.setStatementsRecovery((this.operation.reconcileFlags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0); > parser.setBindingsRecovery((this.operation.reconcileFlags & ICompilationUnit.ENABLE_BINDINGS_RECOVERY) != 0); > parser.setSource(this.workingCopy); >+ if ((this.operation.reconcileFlags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0) >+ parser.ignoreMethodBodies(); > return (org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(this.operation.progressMonitor); > } > return this.operation.makeConsistent(this.workingCopy); >Index: compiler/org/eclipse/jdt/internal/compiler/Compiler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java,v >retrieving revision 1.114 >diff -u -r1.114 Compiler.java >--- compiler/org/eclipse/jdt/internal/compiler/Compiler.java 28 Apr 2009 16:53:03 -0000 1.114 >+++ compiler/org/eclipse/jdt/internal/compiler/Compiler.java 20 Nov 2009 09:39:50 -0000 >@@ -48,6 +48,7 @@ > public int annotationProcessorStartIndex = 0; > public ReferenceBinding[] referenceBindings; > public boolean useSingleThread = true; // by default the compiler will not use worker threads to read/process/write >+ protected boolean ignoreMethodBodies; > > // number of initial units parsed at once (-1: none) > >@@ -279,6 +280,7 @@ > this.lookupEnvironment = new LookupEnvironment(this, this.options, this.problemReporter, environment); > this.out = out == null ? new PrintWriter(System.out, true) : out; > this.stats = new CompilerStats(); >+ this.ignoreMethodBodies = false; > initializeParser(); > } > >@@ -549,6 +551,19 @@ > return null; > } > >+ protected void getMethodBodies(CompilationUnitDeclaration unit) { >+ this.parser.getMethodBodies(unit); >+ if (this.ignoreMethodBodies) { >+ org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = unit.types; >+ if (types != null) { >+ for (int j = 0, typeLength = types.length; j < typeLength; j++) { >+ types[j].deleteMethodBodiesWithoutLocalTypes(this.parser, unit); >+ } >+ } >+ >+ } >+ } >+ > public void setBinaryTypes(ReferenceBinding[] binaryTypes) { > this.referenceBindings = binaryTypes; > } >@@ -742,7 +757,7 @@ > this.lookupEnvironment.unitBeingCompleted = unit; > long parseStart = System.currentTimeMillis(); > >- this.parser.getMethodBodies(unit); >+ getMethodBodies(unit); > > long resolveStart = System.currentTimeMillis(); > this.stats.parseTime += resolveStart - parseStart; >@@ -760,16 +775,15 @@ > > long analyzeStart = System.currentTimeMillis(); > this.stats.resolveTime += analyzeStart - resolveStart; >- >- // flow analysis >- unit.analyseCode(); >+ >+ //No need of analysis or generation of code if statements are not required >+ if (!this.ignoreMethodBodies) unit.analyseCode(); // flow analysis > > long generateStart = System.currentTimeMillis(); > this.stats.analyzeTime += generateStart - analyzeStart; >- >- // code generation >- unit.generateCode(); >- >+ >+ if (!this.ignoreMethodBodies) unit.generateCode(); // code generation >+ > // reference info > if (this.options.produceReferenceInfo && unit.scope != null) > unit.scope.storeDependencyInfo(); >@@ -871,7 +885,7 @@ > this.lookupEnvironment.completeTypeBindings(); > } > this.lookupEnvironment.unitBeingCompleted = unit; >- this.parser.getMethodBodies(unit); >+ getMethodBodies(unit); > if (unit.scope != null) { > // fault in fields & methods > unit.scope.faultInTypes(); >Index: model/org/eclipse/jdt/core/ICompilationUnit.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java,v >retrieving revision 1.69 >diff -u -r1.69 ICompilationUnit.java >--- model/org/eclipse/jdt/core/ICompilationUnit.java 28 Jan 2009 14:42:53 -0000 1.69 >+++ model/org/eclipse/jdt/core/ICompilationUnit.java 20 Nov 2009 09:39:56 -0000 >@@ -63,6 +63,14 @@ > public static final int ENABLE_BINDINGS_RECOVERY = 0x04; > > /** >+ * Constant indicating that a reconcile operation could ignore to parse the method bodies. >+ * @see ASTParser#ignoreMethodBodies() >+ * @since 3.5.2 >+ */ >+public static final int IGNORE_METHOD_BODIES = 0x08; >+ >+ >+/** > * Applies a text edit to the compilation unit's buffer. > * <p> > * Note that the edit is simply applied to the compilation unit's buffer. >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java,v >retrieving revision 1.84 >diff -u -r1.84 BatchASTCreationTests.java >--- src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 11 Feb 2009 15:53:26 -0000 1.84 >+++ src/org/eclipse/jdt/core/tests/dom/BatchASTCreationTests.java 20 Nov 2009 09:40:03 -0000 >@@ -2208,4 +2208,79 @@ > }, > "LA~B<LC;:1TV;LC;:1TE;>;"); > } >+ >+ public void testIgnoreMethodBodies1() throws CoreException { >+ this.workingCopies = createWorkingCopies(new String[] { >+ "/P/p1/X.java", >+ "package p1;\n" + >+ "public class X {\n" + >+ " public int foo() {\n" + >+ " int i = 0;\n" + >+ " }\n" + >+ " public int bar() {\n" + >+ " int i = 0;\n" + >+ " new X() /*start*/{\n" + >+ " }/*end*/;" + >+ " }\n" + >+ "}", >+ }); >+ TestASTRequestor requestor = new TestASTRequestor(); >+ ASTParser parser = ASTParser.newParser(AST.JLS3); >+ parser.ignoreMethodBodies(); >+ parser.createASTs(this.workingCopies, new String[] {}, requestor, null); >+ // statement declaring i should not be in the AST >+ assertASTNodesEqual( >+ "package p1;\n" + >+ "public class X {\n" + >+ " public int foo(){\n" + >+ " }\n" + >+ " public int bar(){\n" + >+ " int i=0;\n" + >+ " new X(){\n" + >+ " }\n" + >+ ";\n" + >+ " }\n" + >+ "}\n" + >+ "\n", >+ requestor.asts >+ ); >+ } >+ public void testIgnoreMethodBodies2() throws CoreException { >+ this.workingCopies = createWorkingCopies(new String[] { >+ "/P/p1/X.java", >+ "package p1;\n" + >+ "public class X {\n" + >+ " public int foo() {\n" + >+ " int i = 0;\n" + >+ " }\n" + >+ " public int bar() {\n" + >+ " int i = 0;\n" + >+ " new X() /*start*/{\n" + >+ " }/*end*/;" + >+ " }\n" + >+ "}", >+ }); >+ TestASTRequestor requestor = new TestASTRequestor(); >+ ASTParser parser = ASTParser.newParser(AST.JLS3); >+ parser.ignoreMethodBodies(); >+ parser.setResolveBindings(true); >+ parser.setProject(getJavaProject("P")); >+ parser.createASTs(this.workingCopies, new String[] {}, requestor, null); >+ // statement declaring i should not be in the AST >+ assertASTNodesEqual( >+ "package p1;\n" + >+ "public class X {\n" + >+ " public int foo(){\n" + >+ " }\n" + >+ " public int bar(){\n" + >+ " int i=0;\n" + >+ " new X(){\n" + >+ " }\n" + >+ ";\n" + >+ " }\n" + >+ "}\n" + >+ "\n", >+ requestor.asts >+ ); >+ } > } >Index: src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java,v >retrieving revision 1.144 >diff -u -r1.144 ReconcilerTests.java >--- src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 28 Apr 2009 17:46:12 -0000 1.144 >+++ src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java 20 Nov 2009 09:40:05 -0000 >@@ -4323,4 +4323,71 @@ > deleteProject("P1"); > } > } >+/* >+ * Ensure that the option ICompilationUnit.IGNORE_METHOD_BODIES is honored >+ */ >+public void testIgnoreMethodBodies1() throws CoreException { >+ setWorkingCopyContents( >+ "package p1;\n" + >+ "import p2.*;" + >+ "public class X {\n" + >+ " public int foo() {\n" + // force an error by not returning >+ " int i = 0;\n" + >+ " }\n" + >+ "}"); >+ org.eclipse.jdt.core.dom.CompilationUnit ast = this.workingCopy.reconcile(AST.JLS3, ICompilationUnit.IGNORE_METHOD_BODIES, null, null); >+ // X.foo() not returning any value should not be reported >+ assertProblems("Working copy should have problems:", >+ "----------\n" + >+ "1. WARNING in /Reconciler/src/p1/X.java (at line 2)\n"+ >+ " import p2.*;public class X {\n" + >+ " ^^\n" + >+ "The import p2 is never used\n"+ >+ "----------\n" >+ ); >+ // statement declaring i should not be in the AST >+ assertASTNodeEquals( >+ "Unexpected participant ast", >+ "package p1;\n" + >+ "import p2.*;\n" + >+ "public class X {\n" + >+ " public int foo(){\n" + >+ " }\n" + >+ "}\n", >+ ast >+ ); >+} >+public void testIgnoreMethodBodies2() throws CoreException { >+ setWorkingCopyContents( >+ "package p1;\n" + >+ "import p2.*;" + >+ "public class X {\n" + >+ " public void foo() {\n" + >+ " int i = 0;\n" + >+ " }\n" + >+ " public int bar() {\n" + >+ " int i = 0;\n" + >+ " new X() /*start*/{\n" + >+ " }/*end*/;" + >+ " }\n" + >+ "}"); >+ org.eclipse.jdt.core.dom.CompilationUnit ast = this.workingCopy.reconcile(AST.JLS3, ICompilationUnit.IGNORE_METHOD_BODIES, null, null); >+ // methods with anonymous classes should have their statements intact >+ assertASTNodeEquals( >+ "Unexpected ast", >+ "package p1;\n" + >+ "import p2.*;\n" + >+ "public class X {\n" + >+ " public void foo(){\n" + >+ " }\n" + >+ " public int bar(){\n" + >+ " int i=0;\n" + >+ " new X(){\n" + >+ " }\n" + >+ ";\n" + >+ " }\n" + >+ "}\n", >+ ast >+ ); >+} > } >#P org.eclipse.jdt.apt.tests >Index: src/org/eclipse/jdt/apt/tests/AptBuilderTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/AptBuilderTests.java,v >retrieving revision 1.27 >diff -u -r1.27 AptBuilderTests.java >--- src/org/eclipse/jdt/apt/tests/AptBuilderTests.java 3 Apr 2008 20:47:18 -0000 1.27 >+++ src/org/eclipse/jdt/apt/tests/AptBuilderTests.java 20 Nov 2009 09:40:09 -0000 >@@ -370,9 +370,9 @@ > // Note that p1.p2.p3.p4.A is showing up twice because it has annotations, and we need to > // parse the source, parsing runs through the compiler, and this registers the > // file a second time with the Compiler#DebugRequestor >- // >- expectingCompiledClasses(new String[]{"p1.p2.p3.p4.C", "p1.p2.p3.p4.A", "p1.p2.p3.p4.A"}); //$NON-NLS-1$ //$NON-NLS-2$ >- expectingCompilingOrder(new String[]{"p1.p2.p3.p4.C", "p1.p2.p3.p4.A", "p1.p2.p3.p4.A"}); //$NON-NLS-1$ //$NON-NLS-2$ >+ // >+ expectingCompiledClasses(new String[]{"p1.p2.p3.p4.C", "p1.p2.p3.p4.A"}); //$NON-NLS-1$ //$NON-NLS-2$ >+ expectingCompilingOrder(new String[]{"p1.p2.p3.p4.C", "p1.p2.p3.p4.A"}); //$NON-NLS-1$ //$NON-NLS-2$ > > // > // now make sure that p1.p2.p3.p4.C is not compiled when A uses NoOp Annotation >@@ -448,14 +448,14 @@ > > fullBuild( project.getFullPath() ); > expectingNoProblems(); >- expectingCompiledClasses(new String[] {"p1.A", "p1.A", "generatedfilepackage.GeneratedFileTest"}); //$NON-NLS-1 //$NON_NLS-2$ >+ expectingCompiledClasses(new String[] {"p1.A", "generatedfilepackage.GeneratedFileTest"}); //$NON-NLS-1 //$NON_NLS-2$ > > // touch A - make sure its public shape changes. > env.addClass( srcRoot, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ > modifiedCode ); > incrementalBuild( project.getFullPath() ); > expectingNoProblems(); >- expectingCompiledClasses(new String[]{"p1.A", "p1.A"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ expectingCompiledClasses(new String[]{"p1.A"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 288211
:
152025
|
152566
|
152688
|
152956
|
152989
|
153054
|
153055
|
153180
|
153220
|
153221
|
153295