diff --git a/sources/net.sf.j2s.ajax/.classpath b/sources/net.sf.j2s.ajax/.classpath index 2873aaafd..56136db82 100644 --- a/sources/net.sf.j2s.ajax/.classpath +++ b/sources/net.sf.j2s.ajax/.classpath @@ -10,6 +10,6 @@ - + diff --git a/sources/net.sf.j2s.ajax/lib/javax.servlet_2.5.0.v200910301333.jar b/sources/net.sf.j2s.ajax/lib/javax.servlet_2.5.0.v200910301333.jar new file mode 100644 index 000000000..20b5755ec Binary files /dev/null and b/sources/net.sf.j2s.ajax/lib/javax.servlet_2.5.0.v200910301333.jar differ diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/DependencyASTVisitor.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/DependencyASTVisitor.java index aebc67137..3dd358c73 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/DependencyASTVisitor.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/DependencyASTVisitor.java @@ -18,7 +18,6 @@ import java.util.Iterator; import java.util.List; import java.util.Set; - import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; import org.eclipse.jdt.core.dom.Annotation; diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/AbstractImageBuilder.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/AbstractImageBuilder.java index 927fbed65..ac1da1d7f 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/AbstractImageBuilder.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/AbstractImageBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 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 @@ -25,7 +25,6 @@ import org.eclipse.jdt.internal.compiler.util.SimpleSet; import org.eclipse.jdt.internal.compiler.util.SuffixConstants; import org.eclipse.jdt.internal.core.JavaModelManager; -import org.eclipse.jdt.internal.core.PackageFragment; import org.eclipse.jdt.internal.core.util.Messages; import org.eclipse.jdt.internal.core.util.Util; @@ -57,8 +56,7 @@ public abstract class AbstractImageBuilder implements ICompilerRequestor, ICompi protected boolean keepStoringProblemMarkers; protected SimpleSet filesWithAnnotations = null; -//2000 is best compromise between space used and speed -public static int MAX_AT_ONCE = Integer.getInteger(JavaModelManager.MAX_COMPILED_UNITS_AT_ONCE, 2000).intValue(); +public static int MAX_AT_ONCE = 2000; // best compromise between space used and speed public final static String[] JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES = { IMarker.MESSAGE, IMarker.SEVERITY, @@ -294,7 +292,7 @@ protected void compile(SourceFile[] units) { } int unitsLength = units.length; - this.compiledAllAtOnce = MAX_AT_ONCE == 0 || unitsLength <= MAX_AT_ONCE; + this.compiledAllAtOnce = unitsLength <= MAX_AT_ONCE; if (this.compiledAllAtOnce) { // do them all now if (JavaBuilder.DEBUG) @@ -673,14 +671,12 @@ protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] prob // but still try to compile as many source files as possible to help the case when the base libraries are in source if (!this.keepStoringProblemMarkers) return; // only want the one error recorded on this source file + IResource resource = sourceFile.resource; HashSet managedMarkerTypes = JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes(); - problems: for (int i = 0, l = problems.length; i < l; i++) { + for (int i = 0, l = problems.length; i < l; i++) { CategorizedProblem problem = problems[i]; int id = problem.getID(); - // we may use a different resource for certain problems such as IProblem.MissingNonNullByDefaultAnnotationOnPackage - // but at the start of the next problem we should reset it to the source file's resource - IResource resource = sourceFile.resource; - + // handle missing classfile situation if (id == IProblem.IsClassPathCorrect) { String missingClassfileName = problem.getArguments()[0]; @@ -710,38 +706,6 @@ protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] prob boolean managedProblem = false; if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(markerType) || (managedProblem = managedMarkerTypes.contains(markerType))) { - if (id == IProblem.MissingNonNullByDefaultAnnotationOnPackage && !(CharOperation.equals(sourceFile.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME))) { - // for this kind of problem, marker needs to be created on the package instead of on the source file - // see bug 372012 - char[] fileName = sourceFile.getFileName(); - int pkgEnd = CharOperation.lastIndexOf('/', fileName); - if (pkgEnd == -1) - pkgEnd = CharOperation.lastIndexOf(File.separatorChar, fileName); - PackageFragment pkg = null; - if (pkgEnd != -1) - pkg = (PackageFragment) Util.getPackageFragment(sourceFile.getFileName(), pkgEnd, -1 /*no jar separator for java files*/); - - if (pkg != null) { - try { - IMarker[] existingMarkers = pkg.resource().findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); - int len = existingMarkers.length; - for (int j=0; j < len; j++) { - if (((Integer)existingMarkers[j].getAttribute(IJavaModelMarker.ID)).intValue() == IProblem.MissingNonNullByDefaultAnnotationOnPackage) { - continue problems; // marker already present - } - } - } catch (CoreException e) { - // marker retrieval failed, cannot do much - if (JavaModelManager.VERBOSE) { - e.printStackTrace(); - } - } - IResource tempRes = pkg.resource(); - if (tempRes != null) { - resource = tempRes; - } - } - } IMarker marker = resource.createMarker(markerType); String[] attributeNames = JAVA_PROBLEM_MARKER_ATTRIBUTE_NAMES; @@ -765,7 +729,8 @@ protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] prob allValues[index++] = problem.isError() ? S_ERROR : S_WARNING; // severity allValues[index++] = new Integer(id); // ID allValues[index++] = new Integer(problem.getSourceStart()); // start - allValues[index++] = new Integer(problem.getSourceEnd() + 1); // end + int end = problem.getSourceEnd(); + allValues[index++] = new Integer(end > 0 ? end + 1 : end); // end allValues[index++] = new Integer(problem.getSourceLineNumber()); // line allValues[index++] = Util.getProblemArgumentsForMarker(problem.getArguments()); // arguments allValues[index++] = new Integer(problem.getCategoryID()); // category ID diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathLocation.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathLocation.java index 61c3b7bca..ec5d35486 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathLocation.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathLocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2006 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 @@ -18,8 +18,8 @@ public abstract class ClasspathLocation { -static ClasspathLocation forSourceFolder(IContainer sourceFolder, IContainer outputFolder, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean ignoreOptionalProblems) { - return new ClasspathMultiDirectory(sourceFolder, outputFolder, inclusionPatterns, exclusionPatterns, ignoreOptionalProblems); +static ClasspathLocation forSourceFolder(IContainer sourceFolder, IContainer outputFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) { + return new ClasspathMultiDirectory(sourceFolder, outputFolder, inclusionPatterns, exclusionPatterns); } public static ClasspathLocation forBinaryFolder(IContainer binaryFolder, boolean isOutputFolder, AccessRuleSet accessRuleSet) { diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathMultiDirectory.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathMultiDirectory.java index 678e3e26c..b6461175c 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathMultiDirectory.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/ClasspathMultiDirectory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -15,22 +15,20 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.core.util.Util; -public class ClasspathMultiDirectory extends ClasspathDirectory { +class ClasspathMultiDirectory extends ClasspathDirectory { IContainer sourceFolder; char[][] inclusionPatterns; // used by builders when walking source folders char[][] exclusionPatterns; // used by builders when walking source folders boolean hasIndependentOutputFolder; // if output folder is not equal to any of the source folders -public boolean ignoreOptionalProblems; -ClasspathMultiDirectory(IContainer sourceFolder, IContainer binaryFolder, char[][] inclusionPatterns, char[][] exclusionPatterns, boolean ignoreOptionalProblems) { +ClasspathMultiDirectory(IContainer sourceFolder, IContainer binaryFolder, char[][] inclusionPatterns, char[][] exclusionPatterns) { super(binaryFolder, true, null); this.sourceFolder = sourceFolder; this.inclusionPatterns = inclusionPatterns; this.exclusionPatterns = exclusionPatterns; this.hasIndependentOutputFolder = false; - this.ignoreOptionalProblems = ignoreOptionalProblems; // handle the case when a state rebuilds a source folder if (this.inclusionPatterns != null && this.inclusionPatterns.length == 0) @@ -44,8 +42,7 @@ public boolean equals(Object o) { if (!(o instanceof ClasspathMultiDirectory)) return false; ClasspathMultiDirectory md = (ClasspathMultiDirectory) o; - return this.ignoreOptionalProblems == md.ignoreOptionalProblems - && this.sourceFolder.equals(md.sourceFolder) && this.binaryFolder.equals(md.binaryFolder) + return this.sourceFolder.equals(md.sourceFolder) && this.binaryFolder.equals(md.binaryFolder) && CharOperation.equals(this.inclusionPatterns, md.inclusionPatterns) && CharOperation.equals(this.exclusionPatterns, md.exclusionPatterns); } diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/IncrementalImageBuilder.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/IncrementalImageBuilder.java index af3b52c70..ed68dadb3 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/IncrementalImageBuilder.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/IncrementalImageBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -559,8 +559,7 @@ protected boolean findSourceFiles(IResourceDelta sourceDelta, ClasspathMultiDire for (int i = 0, l = this.sourceLocations.length; i < l; i++) { if (this.sourceLocations[i].sourceFolder.getFolder(removedPackagePath).exists()) { // only a package fragment was removed, same as removing multiple source files - if (md.hasIndependentOutputFolder) - createFolder(removedPackagePath, md.binaryFolder); // ensure package exists in the output folder + createFolder(removedPackagePath, md.binaryFolder); // ensure package exists in the output folder IResourceDelta[] removedChildren = sourceDelta.getAffectedChildren(); for (int j = 0, m = removedChildren.length; j < m; j++) if (!findSourceFiles(removedChildren[j], md, segmentCount)) @@ -797,10 +796,6 @@ protected void resetCollections() { } protected void updateProblemsFor(SourceFile sourceFile, CompilationResult result) throws CoreException { - if (CharOperation.equals(sourceFile.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { - IResource pkgResource = sourceFile.resource.getParent(); - pkgResource.deleteMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ZERO); - } IMarker[] markers = JavaBuilder.getProblemsFor(sourceFile.resource); CategorizedProblem[] problems = result.getProblems(); if (problems == null && markers.length == 0) return; diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/JavaBuilder.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/JavaBuilder.java index 6517828ca..d341da1f6 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/JavaBuilder.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/JavaBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -12,6 +12,7 @@ import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; + import org.eclipse.jdt.core.*; import org.eclipse.jdt.core.compiler.*; import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; @@ -20,8 +21,6 @@ import org.eclipse.jdt.internal.core.util.Util; import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.*; public class JavaBuilder extends IncrementalProjectBuilder { @@ -158,7 +157,7 @@ protected IProject[] build(int kind, Map ignored, IProgressMonitor monitor) thro if (this.currentProject == null || !this.currentProject.isAccessible()) return new IProject[0]; if (DEBUG) - System.out.println("\nJavaBuilder: Starting build of " + this.currentProject.getName() //$NON-NLS-1$ + System.out.println("\nStarting build of " + this.currentProject.getName() //$NON-NLS-1$ + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ this.notifier = new BuildNotifier(monitor, this.currentProject); this.notifier.begin(); @@ -170,39 +169,39 @@ protected IProject[] build(int kind, Map ignored, IProgressMonitor monitor) thro if (isWorthBuilding()) { if (kind == FULL_BUILD) { if (DEBUG) - System.out.println("JavaBuilder: Performing full build as requested"); //$NON-NLS-1$ + System.out.println("Performing full build as requested by user"); //$NON-NLS-1$ buildAll(); } else { if ((this.lastState = getLastState(this.currentProject)) == null) { if (DEBUG) - System.out.println("JavaBuilder: Performing full build since last saved state was not found"); //$NON-NLS-1$ + System.out.println("Performing full build since last saved state was not found"); //$NON-NLS-1$ buildAll(); } else if (hasClasspathChanged()) { // if the output location changes, do not delete the binary files from old location // the user may be trying something if (DEBUG) - System.out.println("JavaBuilder: Performing full build since classpath has changed"); //$NON-NLS-1$ + System.out.println("Performing full build since classpath has changed"); //$NON-NLS-1$ buildAll(); } else if (this.nameEnvironment.sourceLocations.length > 0) { // if there is no source to compile & no classpath changes then we are done SimpleLookupTable deltas = findDeltas(); if (deltas == null) { if (DEBUG) - System.out.println("JavaBuilder: Performing full build since deltas are missing after incremental request"); //$NON-NLS-1$ + System.out.println("Performing full build since deltas are missing after incremental request"); //$NON-NLS-1$ buildAll(); } else if (deltas.elementSize > 0) { buildDeltas(deltas); } else if (DEBUG) { - System.out.println("JavaBuilder: Nothing to build since deltas were empty"); //$NON-NLS-1$ + System.out.println("Nothing to build since deltas were empty"); //$NON-NLS-1$ } } else { if (hasStructuralDelta()) { // double check that a jar file didn't get replaced in a binary project if (DEBUG) - System.out.println("JavaBuilder: Performing full build since there are structural deltas"); //$NON-NLS-1$ + System.out.println("Performing full build since there are structural deltas"); //$NON-NLS-1$ buildAll(); } else { if (DEBUG) - System.out.println("JavaBuilder: Nothing to build since there are no source folders and no deltas"); //$NON-NLS-1$ + System.out.println("Nothing to build since there are no source folders and no deltas"); //$NON-NLS-1$ this.lastState.tagAsNoopBuild(); } } @@ -240,8 +239,8 @@ protected IProject[] build(int kind, Map ignored, IProgressMonitor monitor) thro } IProject[] requiredProjects = getRequiredProjects(true); if (DEBUG) - System.out.println("JavaBuilder: Finished build of " + this.currentProject.getName() //$NON-NLS-1$ - + " @ " + new Date(System.currentTimeMillis()) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("Finished build of " + this.currentProject.getName() //$NON-NLS-1$ + + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ return requiredProjects; } @@ -249,7 +248,7 @@ private void buildAll() { this.notifier.checkCancel(); this.notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); if (DEBUG && this.lastState != null) - System.out.println("JavaBuilder: Clearing last state : " + this.lastState); //$NON-NLS-1$ + System.out.println("Clearing last state : " + this.lastState); //$NON-NLS-1$ clearLastState(); BatchImageBuilder imageBuilder = new Java2ScriptBatchImageBuilder(this, true); imageBuilder.build(); @@ -260,14 +259,14 @@ private void buildDeltas(SimpleLookupTable deltas) { this.notifier.checkCancel(); this.notifier.subTask(Messages.bind(Messages.build_preparingBuild, this.currentProject.getName())); if (DEBUG && this.lastState != null) - System.out.println("JavaBuilder: Clearing last state : " + this.lastState); //$NON-NLS-1$ + System.out.println("Clearing last state : " + this.lastState); //$NON-NLS-1$ clearLastState(); // clear the previously built state so if the build fails, a full build will occur next time IncrementalImageBuilder imageBuilder = new Java2ScriptIncrementalImageBuilder(this); if (imageBuilder.build(deltas)) { recordNewState(imageBuilder.newState); } else { if (DEBUG) - System.out.println("JavaBuilder: Performing full build since incremental build failed"); //$NON-NLS-1$ + System.out.println("Performing full build since incremental build failed"); //$NON-NLS-1$ buildAll(); } } @@ -277,7 +276,7 @@ protected void clean(IProgressMonitor monitor) throws CoreException { if (this.currentProject == null || !this.currentProject.isAccessible()) return; if (DEBUG) - System.out.println("\nJavaBuilder: Cleaning " + this.currentProject.getName() //$NON-NLS-1$ + System.out.println("\nCleaning " + this.currentProject.getName() //$NON-NLS-1$ + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ this.notifier = new BuildNotifier(monitor, this.currentProject); this.notifier.begin(); @@ -286,7 +285,7 @@ protected void clean(IProgressMonitor monitor) throws CoreException { initializeBuilder(CLEAN_BUILD, true); if (DEBUG) - System.out.println("JavaBuilder: Clearing last state as part of clean : " + this.lastState); //$NON-NLS-1$ + System.out.println("Clearing last state as part of clean : " + this.lastState); //$NON-NLS-1$ clearLastState(); removeProblemsAndTasksFor(this.currentProject); new BatchImageBuilder(this, false).cleanOutputFolders(false); @@ -298,7 +297,7 @@ protected void clean(IProgressMonitor monitor) throws CoreException { cleanup(); } if (DEBUG) - System.out.println("JavaBuilder: Finished cleaning " + this.currentProject.getName() //$NON-NLS-1$ + System.out.println("Finished cleaning " + this.currentProject.getName() //$NON-NLS-1$ + " @ " + new Date(System.currentTimeMillis())); //$NON-NLS-1$ } @@ -367,12 +366,12 @@ private SimpleLookupTable findDeltas() { if (delta != null) { if (delta.getKind() != IResourceDelta.NO_CHANGE) { if (DEBUG) - System.out.println("JavaBuilder: Found source delta for: " + this.currentProject.getName()); //$NON-NLS-1$ + System.out.println("Found source delta for: " + this.currentProject.getName()); //$NON-NLS-1$ deltas.put(this.currentProject, delta); } } else { if (DEBUG) - System.out.println("JavaBuilder: Missing delta for: " + this.currentProject.getName()); //$NON-NLS-1$ + System.out.println("Missing delta for: " + this.currentProject.getName()); //$NON-NLS-1$ this.notifier.subTask(""); //$NON-NLS-1$ return null; } @@ -402,12 +401,12 @@ private SimpleLookupTable findDeltas() { if (delta != null) { if (delta.getKind() != IResourceDelta.NO_CHANGE) { if (DEBUG) - System.out.println("JavaBuilder: Found binary delta for: " + p.getName()); //$NON-NLS-1$ + System.out.println("Found binary delta for: " + p.getName()); //$NON-NLS-1$ deltas.put(p, delta); } } else { if (DEBUG) - System.out.println("JavaBuilder: Missing delta for: " + p.getName()); //$NON-NLS-1$ + System.out.println("Missing delta for: " + p.getName()); //$NON-NLS-1$ this.notifier.subTask(""); //$NON-NLS-1$ return null; } @@ -515,7 +514,7 @@ private boolean hasClasspathChanged() { } catch (CoreException ignore) { // skip it } if (DEBUG) { - System.out.println("JavaBuilder: New location: " + newSourceLocations[n] + "\n!= old location: " + oldSourceLocations[o]); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("New location: " + newSourceLocations[n] + "\n!= old location: " + oldSourceLocations[o]); //$NON-NLS-1$ //$NON-NLS-2$ printLocations(newSourceLocations, oldSourceLocations); } return true; @@ -529,7 +528,7 @@ private boolean hasClasspathChanged() { } catch (CoreException ignore) { // skip it } if (DEBUG) { - System.out.println("JavaBuilder: Added non-empty source folder"); //$NON-NLS-1$ + System.out.println("Added non-empty source folder"); //$NON-NLS-1$ printLocations(newSourceLocations, oldSourceLocations); } return true; @@ -540,7 +539,7 @@ private boolean hasClasspathChanged() { continue; } if (DEBUG) { - System.out.println("JavaBuilder: Removed non-empty source folder"); //$NON-NLS-1$ + System.out.println("Removed non-empty source folder"); //$NON-NLS-1$ printLocations(newSourceLocations, oldSourceLocations); } return true; @@ -553,14 +552,14 @@ private boolean hasClasspathChanged() { for (n = o = 0; n < newLength && o < oldLength; n++, o++) { if (newBinaryLocations[n].equals(oldBinaryLocations[o])) continue; if (DEBUG) { - System.out.println("JavaBuilder: New location: " + newBinaryLocations[n] + "\n!= old location: " + oldBinaryLocations[o]); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println("New location: " + newBinaryLocations[n] + "\n!= old location: " + oldBinaryLocations[o]); //$NON-NLS-1$ //$NON-NLS-2$ printLocations(newBinaryLocations, oldBinaryLocations); } return true; } if (n < newLength || o < oldLength) { if (DEBUG) { - System.out.println("JavaBuilder: Number of binary folders/jar files has changed:"); //$NON-NLS-1$ + System.out.println("Number of binary folders/jar files has changed:"); //$NON-NLS-1$ printLocations(newBinaryLocations, oldBinaryLocations); } return true; @@ -614,15 +613,7 @@ private int initializeBuilder(int kind, boolean forBuild) throws CoreException { // Flush the existing external files cache if this is the beginning of a build cycle String projectName = this.currentProject.getName(); if (builtProjects == null || builtProjects.contains(projectName)) { - try { - Method method = JavaModel.class.getMethod("flushExternalFileCache", new Class[] { Void.class }); - if (method != null) { - method.invoke(JavaModel.class, new Object[0]); - } - } catch (Throwable e) { - e.printStackTrace(); - } - //JavaModel.flushExternalFileCache(); + JavaModel.flushExternalFileCache(); builtProjects = new ArrayList(); } builtProjects.add(projectName); @@ -677,7 +668,7 @@ private boolean isWorthBuilding() throws CoreException { // Abort build only if there are classpath errors if (isClasspathBroken(this.javaProject.getRawClasspath(), this.currentProject)) { if (DEBUG) - System.out.println("JavaBuilder: Aborted build because project has classpath errors (incomplete or involved in cycle)"); //$NON-NLS-1$ + System.out.println("Aborted build because project has classpath errors (incomplete or involved in cycle)"); //$NON-NLS-1$ removeProblemsAndTasksFor(this.currentProject); // remove all compilation problems @@ -707,18 +698,18 @@ private boolean isWorthBuilding() throws CoreException { JavaProject prereq = (JavaProject) JavaCore.create(p); if (prereq.hasCycleMarker() && JavaCore.WARNING.equals(this.javaProject.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true))) { if (DEBUG) - System.out.println("JavaBuilder: Continued to build even though prereq project " + p.getName() //$NON-NLS-1$ + System.out.println("Continued to build even though prereq project " + p.getName() //$NON-NLS-1$ + " was not built since its part of a cycle"); //$NON-NLS-1$ continue; } if (!hasJavaBuilder(p)) { if (DEBUG) - System.out.println("JavaBuilder: Continued to build even though prereq project " + p.getName() //$NON-NLS-1$ + System.out.println("Continued to build even though prereq project " + p.getName() //$NON-NLS-1$ + " is not built by JavaBuilder"); //$NON-NLS-1$ continue; } if (DEBUG) - System.out.println("JavaBuilder: Aborted build because prereq project " + p.getName() //$NON-NLS-1$ + System.out.println("Aborted build because prereq project " + p.getName() //$NON-NLS-1$ + " was not built"); //$NON-NLS-1$ removeProblemsAndTasksFor(this.currentProject); // make this the only problem for this project @@ -755,7 +746,7 @@ void mustPropagateStructuralChanges() { IProject project = this.workspaceRoot.getProject(participantPath.segment(0)); if (hasBeenBuilt(project)) { if (DEBUG) - System.out.println("JavaBuilder: Requesting another build iteration since cycle participant " + project.getName() //$NON-NLS-1$ + System.out.println("Requesting another build iteration since cycle participant " + project.getName() //$NON-NLS-1$ + " has not yet seen some structural changes"); //$NON-NLS-1$ needRebuild(); return; @@ -765,10 +756,10 @@ void mustPropagateStructuralChanges() { } private void printLocations(ClasspathLocation[] newLocations, ClasspathLocation[] oldLocations) { - System.out.println("JavaBuilder: New locations:"); //$NON-NLS-1$ + System.out.println("New locations:"); //$NON-NLS-1$ for (int i = 0, length = newLocations.length; i < length; i++) System.out.println(" " + newLocations[i].debugPathString()); //$NON-NLS-1$ - System.out.println("JavaBuilder: Old locations:"); //$NON-NLS-1$ + System.out.println("Old locations:"); //$NON-NLS-1$ for (int i = 0, length = oldLocations.length; i < length; i++) System.out.println(" " + oldLocations[i].debugPathString()); //$NON-NLS-1$ } @@ -799,7 +790,7 @@ private void recordNewState(State state) { } if (DEBUG) - System.out.println("JavaBuilder: Recording new state : " + state); //$NON-NLS-1$ + System.out.println("Recording new state : " + state); //$NON-NLS-1$ // state.dump(); JavaModelManager.getJavaModelManager().setLastBuiltState(currentProject, newState); } diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/NameEnvironment.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/NameEnvironment.java index bd778cd8b..f98db011b 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/NameEnvironment.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/NameEnvironment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2008 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 @@ -7,11 +7,6 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Terry Parker - * - Contribution for https://bugs.eclipse.org/bugs/show_bug.cgi?id=372418 - * - Another problem with inner classes referenced from jars or class folders: "The type ... cannot be resolved" - * Stephan Herrmann - Contribution for - * Bug 392727 - Cannot compile project when a java file contains $ in its file name *******************************************************************************/ package net.sf.j2s.core.builder; @@ -119,7 +114,7 @@ private void computeClasspathLocations( createOutputFolder(outputFolder); } sLocations.add( - ClasspathLocation.forSourceFolder((IContainer) target, outputFolder, entry.fullInclusionPatternChars(), entry.fullExclusionPatternChars(), entry.ignoreOptionalProblems())); + ClasspathLocation.forSourceFolder((IContainer) target, outputFolder, entry.fullInclusionPatternChars(), entry.fullExclusionPatternChars())); continue nextEntry; case IClasspathEntry.CPE_PROJECT : @@ -276,20 +271,9 @@ private NameEnvironmentAnswer findClass(String qualifiedTypeName, char[] typeNam // if an additional source file is waiting to be compiled, answer it BUT not if this is a secondary type search // if we answer X.java & it no longer defines Y then the binary type looking for Y will think the class path is wrong // let the recompile loop fix up dependents when the secondary type Y has been deleted from X.java - // Only enclosing type names are present in the additional units table, so strip off inner class specifications - // when doing the lookup (https://bugs.eclipse.org/372418). - // Also take care of $ in the name of the class (https://bugs.eclipse.org/377401) - // and prefer name with '$' if unit exists rather than failing to search for nested class (https://bugs.eclipse.org/392727) SourceFile unit = (SourceFile) this.additionalUnits.get(qualifiedTypeName); // doesn't have file extension if (unit != null) return new NameEnvironmentAnswer(unit, null /*no access restriction*/); - int index = qualifiedTypeName.indexOf('$'); - if (index > 0) { - String enclosingTypeName = qualifiedTypeName.substring(0, index); - unit = (SourceFile) this.additionalUnits.get(enclosingTypeName); // doesn't have file extension - if (unit != null) - return new NameEnvironmentAnswer(unit, null /*no access restriction*/); - } } String qBinaryFileName = qualifiedTypeName + SUFFIX_STRING_class; diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/SourceFile.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/SourceFile.java index e026504b6..07dbce02e 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/SourceFile.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/SourceFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 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 @@ -103,9 +103,6 @@ public char[][] getPackageName() { public int hashCode() { return this.initialTypeName.hashCode(); } -public boolean ignoreOptionalProblems() { - return this.sourceLocation.ignoreOptionalProblems; -} String typeLocator() { return this.resource.getProjectRelativePath().toString(); } diff --git a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/State.java b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/State.java index b00f23db8..7990d3b19 100644 --- a/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/State.java +++ b/sources/net.sf.j2s.core/src/net/sf/j2s/core/builder/State.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2011 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 @@ -27,7 +27,7 @@ public class State { // NOTE: this state cannot contain types that are not defined in this project String javaProjectName; -public ClasspathMultiDirectory[] sourceLocations; +ClasspathMultiDirectory[] sourceLocations; ClasspathLocation[] binaryLocations; // keyed by the project relative path of the type (i.e. "src1/p1/p2/A.java"), value is a ReferenceCollection or an AdditionalTypeCollection SimpleLookupTable references; @@ -44,7 +44,7 @@ public class State { private StringSet structurallyChangedTypes; public static int MaxStructurallyChangedTypes = 100; // keep track of ? structurally changed types, otherwise consider all to be changed -public static final byte VERSION = 0x001B; +public static final byte VERSION = 0x001A; // fix for 287164 static final byte SOURCE_FOLDER = 1; static final byte BINARY_FOLDER = 2; @@ -246,7 +246,7 @@ static State read(IProject project, DataInputStream in) throws IOException { if ((folderName = in.readUTF()).length() > 0) sourceFolder = project.getFolder(folderName); if ((folderName = in.readUTF()).length() > 0) outputFolder = project.getFolder(folderName); ClasspathMultiDirectory md = - (ClasspathMultiDirectory) ClasspathLocation.forSourceFolder(sourceFolder, outputFolder, readNames(in), readNames(in), in.readBoolean()); + (ClasspathMultiDirectory) ClasspathLocation.forSourceFolder(sourceFolder, outputFolder, readNames(in), readNames(in)); if (in.readBoolean()) md.hasIndependentOutputFolder = true; newState.sourceLocations[i] = md; @@ -425,7 +425,6 @@ void write(DataOutputStream out) throws IOException { out.writeUTF(md.binaryFolder.getProjectRelativePath().toString()); writeNames(md.inclusionPatterns, out); writeNames(md.exclusionPatterns, out); - out.writeBoolean(md.ignoreOptionalProblems); out.writeBoolean(md.hasIndependentOutputFolder); } diff --git a/sources/net.sf.j2s.java.core/.gitignore b/sources/net.sf.j2s.java.core/.gitignore new file mode 100644 index 000000000..5e56e040e --- /dev/null +++ b/sources/net.sf.j2s.java.core/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SApplicationRunnable.java b/sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SApplicationRunnable.java index 10e9189a8..dfaa4ac20 100644 --- a/sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SApplicationRunnable.java +++ b/sources/net.sf.j2s.ui/src/net/sf/j2s/ui/launching/J2SApplicationRunnable.java @@ -12,12 +12,12 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.program.Program; import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewReference; +//import org.eclipse.ui.IViewReference; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; -import org.eclipse.ui.internal.WorkbenchPage; +//import org.eclipse.ui.internal.WorkbenchPage; public class J2SApplicationRunnable implements Runnable { ILaunchConfiguration configuration; @@ -30,7 +30,7 @@ public J2SApplicationRunnable(ILaunchConfiguration configuration, String url) { public void run() { boolean isToViewInConsole = true; - boolean isViewFast = false; +// boolean isViewFast = false; boolean isViewMaximize = false; try { IPreferenceStore store = Java2ScriptUIPlugin.getDefault().getPreferenceStore(); @@ -41,8 +41,8 @@ public void run() { IJ2SLauchingConfiguration.VIEW_IN_INNER_J2S_CONSOLE, preferred); isViewMaximize = configuration.getAttribute( IJ2SLauchingConfiguration.MAXIMIZE_J2S_CONSOLE, false); - isViewFast = configuration.getAttribute( - IJ2SLauchingConfiguration.FAST_VIEW_J2S_CONSOLE, false); +// isViewFast = configuration.getAttribute( +// IJ2SLauchingConfiguration.FAST_VIEW_J2S_CONSOLE, false); } catch (CoreException e1) { e1.printStackTrace(); } @@ -80,9 +80,9 @@ public void run() { J2SConsoleView j2sConsole = (J2SConsoleView) console; IWorkbenchPage page = j2sConsole.getViewSite().getWorkbenchWindow() .getActivePage(); - WorkbenchPage wp = (WorkbenchPage) page; - IViewReference ref = wp - .findViewReference("net.sf.j2s.ui.console.J2SConsoleView"); +// WorkbenchPage wp = (WorkbenchPage) page; +// IViewReference ref = wp +// .findViewReference("net.sf.j2s.ui.console.J2SConsoleView"); // if (isViewFast && !wp.isFastView(ref)) { // wp.addFastView(ref); // }