mirror of
https://github.com/processing/processing4.git
synced 2026-04-27 14:40:54 +02:00
JavaCore ignores all warnings now, which keeps it from poestering the user about the derived files.
This commit is contained in:
@@ -13,8 +13,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
@@ -24,8 +22,6 @@ import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
|
||||
import processing.plugin.core.builder.Utilities;
|
||||
@@ -132,11 +128,7 @@ public final class ProcessingCore extends Plugin {
|
||||
return ResourcesPlugin.getWorkspace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the single instance of the Processing core plug-in runtime class.
|
||||
*
|
||||
* @return the single instance of the Processing core plug-in runtime class
|
||||
*/
|
||||
/** Returns the single instance of the Processing core plug-in runtime class. */
|
||||
public static ProcessingCore getProcessingCore(){
|
||||
return plugin;
|
||||
}
|
||||
@@ -224,5 +216,26 @@ public final class ProcessingCore extends Plugin {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and retrieves core.jar in the resource bundle.
|
||||
*
|
||||
* @return File core.jar
|
||||
*/
|
||||
public File getCoreJarFile(){
|
||||
URL coreLoc = getPluginResource("lib");
|
||||
try{
|
||||
File folder = new File(FileLocator.toFileURL(coreLoc).getPath());
|
||||
if (folder.exists()){
|
||||
File core = new File(folder, "core.jar");
|
||||
if (core.exists())
|
||||
return core;
|
||||
}
|
||||
}catch (Exception e) {
|
||||
ProcessingLog.logError(e);
|
||||
}
|
||||
ProcessingLog.logInfo("Something went wrong getting the core.jar file from the Processing plug-in. All sketches will break without this. Please reinstall the plug-in.");
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -190,7 +190,10 @@ public class SketchBuilder extends IncrementalProjectBuilder{
|
||||
if (codeFolder != null && codeFolder.exists()){
|
||||
String codeFolderClassPath = Utilities.contentsToClassPath(codeFolder.getLocation().toFile());
|
||||
for( String s : codeFolderClassPath.split(File.separator)){
|
||||
libraryJarPathList.add(new Path(s).makeAbsolute());
|
||||
if (!s.isEmpty()){
|
||||
libraryJarPathList.add(new Path(s).makeAbsolute());
|
||||
// System.out.println("Library added " + s);
|
||||
}
|
||||
}
|
||||
codeFolderPackages = Utilities.packageListFromClassPath(codeFolderClassPath);
|
||||
// srcFolderPathList.add(codeFolder.getFullPath()); // TODO verify this.
|
||||
@@ -235,6 +238,7 @@ public class SketchBuilder extends IncrementalProjectBuilder{
|
||||
inStream.close();
|
||||
}
|
||||
srcFolderPathList.add(buildFolder.getFullPath());
|
||||
// System.out.println("Source added " + buildFolder.getFullPath());
|
||||
} catch(antlr.RecognitionException re){
|
||||
|
||||
IResource errorFile = null; // if this remains null, the error is reported back on the sketch itself with no line number
|
||||
@@ -370,7 +374,7 @@ public class SketchBuilder extends IncrementalProjectBuilder{
|
||||
|
||||
libs.addAll( Utilities.getLibraryJars(ProcessingCore.getProcessingCore().getCoreLibsFolder()) );
|
||||
libs.addAll( Utilities.getLibraryJars(Utilities.getSketchBookLibsFolder(sketch)) );
|
||||
|
||||
|
||||
// setup the library table
|
||||
HashMap<String, IPath> importToLibraryTable = new HashMap<String, IPath>();
|
||||
|
||||
@@ -394,6 +398,7 @@ public class SketchBuilder extends IncrementalProjectBuilder{
|
||||
IPath libPath = importToLibraryTable.get(entry);
|
||||
if (libPath != null ){
|
||||
libraryJarPathList.add(libPath.makeAbsolute()); // huzzah! we've found it, make sure its fed to the compiler
|
||||
// System.out.println("Extra lib added: " + libPath.makeAbsolute());
|
||||
} else {
|
||||
// The user is trying to import something we won't be able to find.
|
||||
reportProblem(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package processing.plugin.core.builder;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.ICommand;
|
||||
@@ -21,6 +21,8 @@ import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.jdt.core.IClasspathEntry;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.eclipse.jdt.launching.IVMInstall;
|
||||
import org.eclipse.jdt.launching.JavaRuntime;
|
||||
|
||||
import processing.plugin.core.ProcessingCore;
|
||||
import processing.plugin.core.ProcessingLog;
|
||||
@@ -319,15 +321,19 @@ public class SketchProject implements IProjectNature {
|
||||
IJavaProject jproject = this.getJavaProject();
|
||||
|
||||
// Get a default VM to toss in the mix
|
||||
// IPath containerPath = new Path(JavaRuntime.JRE_CONTAINER);
|
||||
// IVMInstall vm = JavaRuntime.getDefaultVMInstall();
|
||||
// IPath vmPath = containerPath.append(vm.getVMInstallType().getId()).append(vm.getName());
|
||||
IPath containerPath = new Path(JavaRuntime.JRE_CONTAINER);
|
||||
IVMInstall vm = JavaRuntime.getDefaultVMInstall();
|
||||
IPath vmPath = containerPath.append(vm.getVMInstallType().getId()).append(vm.getName());
|
||||
|
||||
// Duplicate entries cause errors, so prep them with a set
|
||||
HashSet<IClasspathEntry> entries = new HashSet<IClasspathEntry>();
|
||||
|
||||
// VM
|
||||
// entries.add(JavaCore.newContainerEntry(vmPath.makeAbsolute())); // JVM
|
||||
entries.add(JavaCore.newContainerEntry(vmPath.makeAbsolute())); // JVM
|
||||
|
||||
// Processing Libraries
|
||||
IPath plibs = new Path(ProcessingCore.getProcessingCore().getCoreJarFile().getAbsolutePath());
|
||||
entries.add(JavaCore.newLibraryEntry( plibs, null, null, false ));
|
||||
|
||||
// if we were given a list of source folders, add them to the list
|
||||
// this should include the build folder and the code folder, if it was necessary
|
||||
@@ -352,20 +358,24 @@ public class SketchProject implements IProjectNature {
|
||||
}
|
||||
}
|
||||
|
||||
// things are added in no particular order
|
||||
|
||||
|
||||
// things are added in no particular order
|
||||
IClasspathEntry[] classpathEntries = new IClasspathEntry[entries.size()];
|
||||
|
||||
int i = 0;
|
||||
for (IClasspathEntry cpe : entries){
|
||||
classpathEntries[i++] = cpe;
|
||||
System.out.println(cpe.toString());
|
||||
// System.out.println(cpe.toString());
|
||||
}
|
||||
|
||||
// for(IClasspathEntry cpe : entries){
|
||||
// try{
|
||||
// //System.out.println("Trying: " + cpe.toString());
|
||||
// jproject.setRawClasspath(new IClasspathEntry[] {cpe}, null);
|
||||
// } catch (Exception e){
|
||||
// System.out.println("It was broken. Ugh.");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
try {
|
||||
jproject.setOutputLocation( getJavaBuildFolder().getFullPath(), null);
|
||||
jproject.setRawClasspath(classpathEntries, null);
|
||||
@@ -374,6 +384,67 @@ public class SketchProject implements IProjectNature {
|
||||
ProcessingLog.logError("There was a problem setting the compiler class path.", e);
|
||||
}
|
||||
|
||||
Hashtable options = JavaCore.getOptions();
|
||||
options.put(JavaCore.COMPILER_PB_ANNOTATION_SUPER_INTERFACE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_AUTOBOXING, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_CHAR_ARRAY_IN_STRING_CONCATENATION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_DEPRECATION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_EMPTY_STATEMENT, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_FALLTHROUGH_CASE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_FINAL_PARAMETER_BOUND, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_FINALLY_BLOCK_NOT_COMPLETING, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_HIDDEN_CATCH_BLOCK, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_INCOMPATIBLE_NON_INHERITED_INTERFACE_METHOD, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_INCOMPLETE_ENUM_SWITCH, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_INVALID_JAVADOC, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS__DEPRECATED_REF, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS_VISIBILITY, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_NO_EFFECT_ASSIGNMENT, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_NON_NLS_STRING_LITERAL, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_NULL_REFERENCE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_PARAMETER_ASSIGNMENT, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_SPECIAL_PARAMETER_HIDING_FIELD, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_SYNTHETIC_ACCESS_EMULATION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_TYPE_PARAMETER_HIDING, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNDOCUMENTED_EMPTY_BLOCK, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNHANDLED_WARNING_TOKEN, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNNECESSARY_ELSE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNNECESSARY_TYPE_CHECK, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNQUALIFIED_FIELD_ACCESS, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_LABEL, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_DECLARED_THROWN_EXCEPTION_WHEN_OVERRIDING, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_IMPLEMENTING_ABSTRACT, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER_WHEN_OVERRIDING_CONCRETE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaCore.IGNORE);
|
||||
options.put(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST, JavaCore.IGNORE);
|
||||
// its finally over! yeah!
|
||||
|
||||
JavaCore.setOptions(options);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package processing.plugin.core.builder;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -19,8 +18,6 @@ import java.util.zip.ZipFile;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
import processing.plugin.core.ProcessingCore;
|
||||
import processing.plugin.core.ProcessingCorePreferences;
|
||||
import processing.plugin.core.ProcessingLog;
|
||||
@@ -102,7 +99,9 @@ public class Utilities {
|
||||
* This function doesn't bother checking to see if there are any .class
|
||||
* files in the folder or within a subfolder.
|
||||
*/
|
||||
static public String contentsToClassPath(File folder) {
|
||||
static public String contentsToClassPath(File folder) {
|
||||
//TODO Review this method and make sure that it is returning only paths directly to jars and zip files
|
||||
// It was returning empty paths which was breaking things. Needs to be reviewed.
|
||||
if (folder == null) return "";
|
||||
|
||||
StringBuffer abuffer = new StringBuffer();
|
||||
@@ -497,5 +496,5 @@ public class Utilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user