Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f1fea8

Browse files
author
zhourenjian
committed
Synchronize sources with Eclipse JDT 3.6
1 parent f4cf28e commit 4f1fea8

9 files changed

+23
-22
lines changed

src/net/sf/j2s/core/builder/AbstractImageBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2008 IBM Corporation and others.
2+
* Copyright (c) 2000, 2009 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -835,7 +835,7 @@ protected void writeClassFileContents(ClassFile classFile, IFile file, String qu
835835
if (JavaBuilder.DEBUG)
836836
System.out.println("Writing changed class file " + file.getName());//$NON-NLS-1$
837837
if (!file.isDerived())
838-
file.setDerived(true);
838+
file.setDerived(true, null);
839839
file.setContents(input, true, false, null);
840840
} else {
841841
// Default implementation just writes out the bytes for the new class file...

src/net/sf/j2s/core/builder/AdditionalTypeCollection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2009 IBM Corporation and others.
2+
* Copyright (c) 2000, 2010 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -16,7 +16,7 @@ public class AdditionalTypeCollection extends ReferenceCollection {
1616

1717
protected AdditionalTypeCollection(char[][] definedTypeNames, char[][][] qualifiedReferences, char[][] simpleNameReferences, char[][] rootReferences) {
1818
super(qualifiedReferences, simpleNameReferences, rootReferences);
19-
this.definedTypeNames = definedTypeNames; // do not bother interning member type names (ie. 'A$M')
19+
this.definedTypeNames = definedTypeNames; // do not bother interning member type names (i.e. 'A$M')
2020
}
2121
}
2222

src/net/sf/j2s/core/builder/BatchImageBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2008 IBM Corporation and others.
2+
* Copyright (c) 2000, 2009 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -105,7 +105,7 @@ protected void cleanOutputFolders(boolean copyBack) throws CoreException {
105105
member.accept(
106106
new IResourceVisitor() {
107107
public boolean visit(IResource resource) throws CoreException {
108-
resource.setDerived(true);
108+
resource.setDerived(true, null);
109109
return resource.getType() != IResource.FILE;
110110
}
111111
}
@@ -137,7 +137,7 @@ public boolean visit(IResourceProxy proxy) throws CoreException {
137137
if (Util.isExcluded(resource.getFullPath(), inclusionPatterns, exclusionPatterns, false))
138138
return false;
139139
if (!resource.isDerived())
140-
resource.setDerived(true);
140+
resource.setDerived(true, null);
141141
resource.delete(IResource.FORCE, null);
142142
}
143143
return false;

src/net/sf/j2s/core/builder/ClasspathJar.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2009 IBM Corporation and others.
2+
* Copyright (c) 2000, 2010 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
1515
import org.eclipse.core.runtime.*;
1616

1717
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
18+
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
1819
import org.eclipse.jdt.internal.compiler.env.AccessRuleSet;
1920
import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
2021
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
@@ -151,7 +152,8 @@ public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPa
151152
String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length);
152153
return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray()));
153154
}
154-
} catch (Exception e) { // treat as if class file is missing
155+
} catch (IOException e) { // treat as if class file is missing
156+
} catch (ClassFormatException e) { // treat as if class file is missing
155157
}
156158
return null;
157159
}

src/net/sf/j2s/core/builder/ClasspathMultiDirectory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2009 IBM Corporation and others.
2+
* Copyright (c) 2000, 2010 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at

src/net/sf/j2s/core/builder/IncrementalImageBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ protected void writeClassFileContents(ClassFile classfile, IFile file, String qu
818818
if (JavaBuilder.DEBUG)
819819
System.out.println("Writing changed class file " + file.getName());//$NON-NLS-1$
820820
if (!file.isDerived())
821-
file.setDerived(true);
821+
file.setDerived(true, null);
822822
file.setContents(new ByteArrayInputStream(bytes), true, false, null);
823823
} else if (JavaBuilder.DEBUG) {
824824
System.out.println("Skipped over unchanged class file " + file.getName());//$NON-NLS-1$

src/net/sf/j2s/core/builder/JavaBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ private IProject[] getRequiredProjects(boolean includeBinaryPrerequisites) {
464464
p = null;
465465
break;
466466
case IClasspathEntry.CPE_LIBRARY :
467-
if (includeBinaryPrerequisites && path.segmentCount() > 1) {
467+
if (includeBinaryPrerequisites && path.segmentCount() > 0) {
468468
// some binary resources on the class path can come from projects that are not included in the project references
469469
IResource resource = this.workspaceRoot.findMember(path.segment(0));
470470
if (resource instanceof IProject) {

src/net/sf/j2s/core/builder/State.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2009 IBM Corporation and others.
2+
* Copyright (c) 2000, 2010 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -29,7 +29,7 @@ public class State {
2929
String javaProjectName;
3030
ClasspathMultiDirectory[] sourceLocations;
3131
ClasspathLocation[] binaryLocations;
32-
// keyed by the project relative path of the type (ie. "src1/p1/p2/A.java"), value is a ReferenceCollection or an AdditionalTypeCollection
32+
// keyed by the project relative path of the type (i.e. "src1/p1/p2/A.java"), value is a ReferenceCollection or an AdditionalTypeCollection
3333
SimpleLookupTable references;
3434
// keyed by qualified type name "p1/p2/A", value is the project relative path which defines this type "src1/p1/p2/A.java"
3535
public SimpleLookupTable typeLocators;
@@ -44,7 +44,7 @@ public class State {
4444
private StringSet structurallyChangedTypes;
4545
public static int MaxStructurallyChangedTypes = 100; // keep track of ? structurally changed types, otherwise consider all to be changed
4646

47-
public static final byte VERSION = 0x0017; // added root name references
47+
public static final byte VERSION = 0x0018; // fix for 291472
4848

4949
static final byte SOURCE_FOLDER = 1;
5050
static final byte BINARY_FOLDER = 2;

src/net/sf/j2s/core/compiler/Java2ScriptImageCompiler.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,15 @@ public void process(CompilationUnitDeclaration unit, int i) {
131131

132132
long analyzeStart = System.currentTimeMillis();
133133
this.stats.resolveTime += analyzeStart - resolveStart;
134-
135-
// flow analysis
136-
unit.analyseCode();
134+
135+
//No need of analysis or generation of code if statements are not required
136+
if (!this.options.ignoreMethodBodies) unit.analyseCode(); // flow analysis
137137

138138
long generateStart = System.currentTimeMillis();
139139
this.stats.analyzeTime += generateStart - analyzeStart;
140-
141-
// code generation
142-
unit.generateCode();
143-
140+
141+
if (!this.options.ignoreMethodBodies) unit.generateCode(); // code generation
142+
144143
// reference info
145144
if (this.options.produceReferenceInfo && unit.scope != null)
146145
unit.scope.storeDependencyInfo();

0 commit comments

Comments
 (0)