mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Cosmetics.
This commit is contained in:
parent
ddb8ab8708
commit
355027f0c9
25 changed files with 751 additions and 761 deletions
|
@ -51,13 +51,13 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
import org.eclipse.cdt.core.dom.ast.IFunctionType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification;
|
||||||
|
@ -114,7 +114,7 @@ public class AST2TestBase extends BaseTestCase {
|
||||||
private static final ScannerInfo SCANNER_INFO = new ScannerInfo(getStdMap());
|
private static final ScannerInfo SCANNER_INFO = new ScannerInfo(getStdMap());
|
||||||
|
|
||||||
private static Map<String, String> getGnuMap() {
|
private static Map<String, String> getGnuMap() {
|
||||||
Map<String, String> map= new HashMap<String, String>();
|
Map<String, String> map= new HashMap<>();
|
||||||
map.put("__GNUC__", Integer.toString(GPPLanguage.GNU_LATEST_VERSION_MAJOR));
|
map.put("__GNUC__", Integer.toString(GPPLanguage.GNU_LATEST_VERSION_MAJOR));
|
||||||
map.put("__GNUC_MINOR__", Integer.toString(GPPLanguage.GNU_LATEST_VERSION_MINOR));
|
map.put("__GNUC_MINOR__", Integer.toString(GPPLanguage.GNU_LATEST_VERSION_MINOR));
|
||||||
map.put("__SIZEOF_SHORT__", "2");
|
map.put("__SIZEOF_SHORT__", "2");
|
||||||
|
@ -125,7 +125,7 @@ public class AST2TestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, String> getStdMap() {
|
private static Map<String, String> getStdMap() {
|
||||||
Map<String, String> map= new HashMap<String, String>();
|
Map<String, String> map= new HashMap<>();
|
||||||
map.put("__SIZEOF_SHORT__", "2");
|
map.put("__SIZEOF_SHORT__", "2");
|
||||||
map.put("__SIZEOF_INT__", "4");
|
map.put("__SIZEOF_INT__", "4");
|
||||||
map.put("__SIZEOF_LONG__", "8");
|
map.put("__SIZEOF_LONG__", "8");
|
||||||
|
@ -173,7 +173,7 @@ public class AST2TestBase extends BaseTestCase {
|
||||||
} else {
|
} else {
|
||||||
config = new ANSICPPParserExtensionConfiguration();
|
config = new ANSICPPParserExtensionConfiguration();
|
||||||
}
|
}
|
||||||
parser = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG,config, null);
|
parser = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG, config, null);
|
||||||
} else {
|
} else {
|
||||||
ICParserExtensionConfiguration config = null;
|
ICParserExtensionConfiguration config = null;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ public class AST2TestBase extends BaseTestCase {
|
||||||
this.shouldVisitImplicitNames = shouldVisitImplicitNames;
|
this.shouldVisitImplicitNames = shouldVisitImplicitNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
public List<IASTName> nameList = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
|
@ -408,7 +408,7 @@ public class AST2TestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
public int numProblemBindings;
|
public int numProblemBindings;
|
||||||
public int numNullBindings;
|
public int numNullBindings;
|
||||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
public List<IASTName> nameList = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
|
@ -438,7 +438,7 @@ public class AST2TestBase extends BaseTestCase {
|
||||||
}
|
}
|
||||||
public int numProblemBindings;
|
public int numProblemBindings;
|
||||||
public int numNullBindings;
|
public int numNullBindings;
|
||||||
public List<IASTName> nameList = new ArrayList<IASTName>();
|
public List<IASTName> nameList = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int visit(IASTName name) {
|
public int visit(IASTName name) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.tests.scanner;
|
package org.eclipse.cdt.core.parser.tests.scanner;
|
||||||
|
|
||||||
|
@ -37,7 +37,6 @@ import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver;
|
import org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver;
|
||||||
|
|
||||||
public abstract class PreprocessorTestsBase extends BaseTestCase {
|
public abstract class PreprocessorTestsBase extends BaseTestCase {
|
||||||
|
|
||||||
private static final IParserLogService NULL_LOG = new NullLogService();
|
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||||
protected CPreprocessor fScanner;
|
protected CPreprocessor fScanner;
|
||||||
protected ILocationResolver fLocationResolver;
|
protected ILocationResolver fLocationResolver;
|
||||||
|
@ -78,11 +77,10 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
||||||
IncludeFileContentProvider readerFactory= FileCodeReaderFactory.getInstance();
|
IncludeFileContentProvider readerFactory= FileCodeReaderFactory.getInstance();
|
||||||
//IScannerExtensionConfiguration scannerConfig;
|
//IScannerExtensionConfiguration scannerConfig;
|
||||||
|
|
||||||
if(scannerConfig == null) {
|
if (scannerConfig == null) {
|
||||||
if (lang == ParserLanguage.C) {
|
if (lang == ParserLanguage.C) {
|
||||||
scannerConfig= GCCScannerExtensionConfiguration.getInstance();
|
scannerConfig= GCCScannerExtensionConfiguration.getInstance();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
scannerConfig= GPPScannerExtensionConfiguration.getInstance(scannerInfo);
|
scannerConfig= GPPScannerExtensionConfiguration.getInstance(scannerInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,10 +104,10 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
||||||
|
|
||||||
protected void fullyTokenize() throws Exception {
|
protected void fullyTokenize() throws Exception {
|
||||||
try {
|
try {
|
||||||
for(;;) {
|
for (;;) {
|
||||||
IToken t= fScanner.nextToken();
|
IToken t= fScanner.nextToken();
|
||||||
}
|
}
|
||||||
} catch ( EndOfFileException e){
|
} catch (EndOfFileException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +174,7 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
||||||
try {
|
try {
|
||||||
IToken t= fScanner.nextToken();
|
IToken t= fScanner.nextToken();
|
||||||
fail("superfluous token " + t);
|
fail("superfluous token " + t);
|
||||||
}
|
} catch(EndOfFileException e) {
|
||||||
catch(EndOfFileException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,5 +208,4 @@ public abstract class PreprocessorTestsBase extends BaseTestCase {
|
||||||
assertEquals(detail, problem.getArguments()[0]);
|
assertEquals(detail, problem.getArguments()[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@ import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
@ -61,7 +59,9 @@ import org.eclipse.ui.dialogs.IOverwriteQuery;
|
||||||
import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
|
import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
|
||||||
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
|
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
|
||||||
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
|
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
|
||||||
|
import org.junit.Assert;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper methods to set up a ICProject.
|
* Helper methods to set up a ICProject.
|
||||||
*/
|
*/
|
||||||
|
@ -357,7 +357,7 @@ public class CProjectHelper {
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public static ITranslationUnit findTranslationUnit(ICProject testProject, String name) throws CModelException, InterruptedException {
|
public static ITranslationUnit findTranslationUnit(ICProject testProject, String name) throws CModelException, InterruptedException {
|
||||||
for (int j=0; j<20; j++) {
|
for (int j = 0; j < 20; j++) {
|
||||||
ICElement[] sourceRoots = testProject.getChildren();
|
ICElement[] sourceRoots = testProject.getChildren();
|
||||||
for (int i = 0; i < sourceRoots.length; i++) {
|
for (int i = 0; i < sourceRoots.length; i++) {
|
||||||
ISourceRoot root = (ISourceRoot) sourceRoots[i];
|
ISourceRoot root = (ISourceRoot) sourceRoots[i];
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Corporation - initial API and implementation
|
* IBM Corporation - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core.testplugin;
|
package org.eclipse.cdt.core.testplugin;
|
||||||
|
|
||||||
// copied from startup.jar. planned to be removed soon
|
// copied from startup.jar. planned to be removed soon
|
||||||
|
@ -73,51 +72,51 @@ public class Main {
|
||||||
/**
|
/**
|
||||||
* Indicates whether this instance is running in debug mode.
|
* Indicates whether this instance is running in debug mode.
|
||||||
*/
|
*/
|
||||||
protected boolean debug = false;
|
protected boolean debug;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The location of the launcher to run.
|
* The location of the launcher to run.
|
||||||
*/
|
*/
|
||||||
protected String bootLocation = null;
|
protected String bootLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of the application to run.
|
* The identifier of the application to run.
|
||||||
*/
|
*/
|
||||||
protected String application;
|
protected String application;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path for finding find plugins.
|
* The path for finding find plugins.
|
||||||
*/
|
*/
|
||||||
protected URL pluginPathLocation;
|
protected URL pluginPathLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The boot path location.
|
* The boot path location.
|
||||||
*/
|
*/
|
||||||
protected String location;
|
protected String location;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether items for UNinstallation should be looked for.
|
* Indicates whether items for UNinstallation should be looked for.
|
||||||
*/
|
*/
|
||||||
protected boolean uninstall = false;
|
protected boolean uninstall;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item to be uninstalled.
|
* The item to be uninstalled.
|
||||||
*/
|
*/
|
||||||
protected String uninstallCookie;
|
protected String uninstallCookie;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class path entries.
|
* The class path entries.
|
||||||
*/
|
*/
|
||||||
protected String devClassPath = null;
|
protected String devClassPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether this instance is running in development mode.
|
* Indicates whether this instance is running in development mode.
|
||||||
*/
|
*/
|
||||||
protected boolean inDevelopmentMode = false;
|
protected boolean inDevelopmentMode;
|
||||||
|
|
||||||
// static token describing how to take down the splash screen
|
// static token describing how to take down the splash screen
|
||||||
private static String endSplash = null;
|
private static String endSplash;
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
private static final String APPLICATION = "-application";
|
private static final String APPLICATION = "-application";
|
||||||
private static final String BOOT = "-boot";
|
private static final String BOOT = "-boot";
|
||||||
|
@ -152,390 +151,398 @@ public class Main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the launch.
|
* Executes the launch.
|
||||||
*
|
*
|
||||||
* @return the result of performing the launch
|
* @return the result of performing the launch
|
||||||
* @param args command-line arguments
|
* @param args command-line arguments
|
||||||
* @exception Exception thrown if a problem occurs during the launch
|
* @exception Exception thrown if a problem occurs during the launch
|
||||||
*/
|
*/
|
||||||
protected Object basicRun(String[] args) throws Exception {
|
protected Object basicRun(String[] args) throws Exception {
|
||||||
Class clazz = getBootLoader(bootLocation);
|
Class clazz = getBootLoader(bootLocation);
|
||||||
Method method = clazz.getDeclaredMethod("run", new Class[] { String.class, URL.class, String.class, String[].class });
|
Method method = clazz.getDeclaredMethod("run", new Class[] { String.class, URL.class, String.class, String[].class });
|
||||||
try {
|
try {
|
||||||
return method.invoke(clazz, new Object[] { application, pluginPathLocation, location, args });
|
return method.invoke(clazz, new Object[] { application, pluginPathLocation, location, args });
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
if (e.getTargetException() instanceof Error)
|
if (e.getTargetException() instanceof Error)
|
||||||
throw (Error) e.getTargetException();
|
throw (Error) e.getTargetException();
|
||||||
else
|
else
|
||||||
throw e;
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the result of converting a list of comma-separated tokens into an array
|
* Returns the result of converting a list of comma-separated tokens into an array
|
||||||
*
|
*
|
||||||
* @return the array of string tokens
|
* @return the array of string tokens
|
||||||
* @param prop the initial comma-separated string
|
* @param prop the initial comma-separated string
|
||||||
*/
|
*/
|
||||||
private String[] getArrayFromList(String prop) {
|
private String[] getArrayFromList(String prop) {
|
||||||
if (prop == null || prop.trim().equals(""))
|
if (prop == null || prop.trim().equals(""))
|
||||||
return new String[0];
|
return new String[0];
|
||||||
List<String> list = new ArrayList<String>();
|
List<String> list = new ArrayList<>();
|
||||||
StringTokenizer tokens = new StringTokenizer(prop, ",");
|
StringTokenizer tokens = new StringTokenizer(prop, ",");
|
||||||
while (tokens.hasMoreTokens()) {
|
while (tokens.hasMoreTokens()) {
|
||||||
String token = tokens.nextToken().trim();
|
String token = tokens.nextToken().trim();
|
||||||
if (!token.equals(""))
|
if (!token.equals(""))
|
||||||
list.add(token);
|
list.add(token);
|
||||||
|
}
|
||||||
|
return list.toArray(new String[list.size()]);
|
||||||
}
|
}
|
||||||
return list.toArray(new String[list.size()]);
|
|
||||||
}
|
/**
|
||||||
/**
|
* Creates and returns a platform <code>BootLoader</code> which can be used to start
|
||||||
* Creates and returns a platform <code>BootLoader</code> which can be used to start
|
* up and run the platform. The given base, if not <code>null</code>,
|
||||||
* up and run the platform. The given base, if not <code>null</code>,
|
* is the location of the boot loader code. If the value is <code>null</code>
|
||||||
* is the location of the boot loader code. If the value is <code>null</code>
|
* then the boot loader is located relative to this class.
|
||||||
* then the boot loader is located relative to this class.
|
*
|
||||||
*
|
* @return the new boot loader
|
||||||
* @return the new boot loader
|
* @param base the location of the boot loader
|
||||||
* @param base the location of the boot loader
|
*/
|
||||||
*/
|
public Class getBootLoader(String base) throws Exception {
|
||||||
public Class getBootLoader(String base) throws Exception {
|
try (URLClassLoader loader = new URLClassLoader(getBootPath(base), null)) {
|
||||||
URLClassLoader loader = new URLClassLoader(getBootPath(base), null);
|
return loader.loadClass(BOOTLOADER);
|
||||||
return loader.loadClass(BOOTLOADER);
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Returns the <code>URL</code>-based class path describing where the boot classes
|
/**
|
||||||
* are located when running in development mode.
|
* Returns the <code>URL</code>-based class path describing where the boot classes
|
||||||
*
|
* are located when running in development mode.
|
||||||
* @return the url-based class path
|
*
|
||||||
* @param base the base location
|
* @return the url-based class path
|
||||||
* @exception MalformedURLException if a problem occurs computing the class path
|
* @param base the base location
|
||||||
*/
|
* @exception MalformedURLException if a problem occurs computing the class path
|
||||||
protected URL[] getDevPath(URL base) throws MalformedURLException {
|
*/
|
||||||
URL url;
|
protected URL[] getDevPath(URL base) throws MalformedURLException {
|
||||||
String devBase = base.toExternalForm();
|
URL url;
|
||||||
if (!inDevelopmentMode) {
|
String devBase = base.toExternalForm();
|
||||||
|
if (!inDevelopmentMode) {
|
||||||
|
url = new URL(devBase + "boot.jar");
|
||||||
|
return new URL[] {url};
|
||||||
|
}
|
||||||
|
String[] locations = getArrayFromList(devClassPath);
|
||||||
|
ArrayList result = new ArrayList(locations.length);
|
||||||
|
for (int i = 0; i < locations.length; i++) {
|
||||||
|
String spec = devBase + locations[i];
|
||||||
|
char lastChar = spec.charAt(spec.length() - 1);
|
||||||
|
if ((spec.endsWith(".jar") || (lastChar == '/' || lastChar == '\\')))
|
||||||
|
url = new URL (spec);
|
||||||
|
else
|
||||||
|
url = new URL(spec + "/");
|
||||||
|
//make sure URL exists before adding to path
|
||||||
|
if (new java.io.File(url.getFile()).exists())
|
||||||
|
result.add(url);
|
||||||
|
}
|
||||||
url = new URL(devBase + "boot.jar");
|
url = new URL(devBase + "boot.jar");
|
||||||
return new URL[] {url};
|
|
||||||
}
|
|
||||||
String[] locations = getArrayFromList(devClassPath);
|
|
||||||
ArrayList result = new ArrayList(locations.length);
|
|
||||||
for (int i = 0; i < locations.length; i++) {
|
|
||||||
String spec = devBase + locations[i];
|
|
||||||
char lastChar = spec.charAt(spec.length() - 1);
|
|
||||||
if ((spec.endsWith(".jar") || (lastChar == '/' || lastChar == '\\')))
|
|
||||||
url = new URL (spec);
|
|
||||||
else
|
|
||||||
url = new URL(spec + "/");
|
|
||||||
//make sure URL exists before adding to path
|
|
||||||
if (new java.io.File(url.getFile()).exists())
|
if (new java.io.File(url.getFile()).exists())
|
||||||
result.add(url);
|
result.add(url);
|
||||||
|
return (URL[])result.toArray(new URL[result.size()]);
|
||||||
}
|
}
|
||||||
url = new URL(devBase + "boot.jar");
|
|
||||||
if (new java.io.File(url.getFile()).exists())
|
|
||||||
result.add(url);
|
|
||||||
return (URL[])result.toArray(new URL[result.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>URL</code>-based class path describing where the boot classes are located.
|
* Returns the <code>URL</code>-based class path describing where the boot classes are located.
|
||||||
*
|
*
|
||||||
* @return the url-based class path
|
* @return the url-based class path
|
||||||
* @param base the base location
|
* @param base the base location
|
||||||
* @exception MalformedURLException if a problem occurs computing the class path
|
* @exception MalformedURLException if a problem occurs computing the class path
|
||||||
*/
|
*/
|
||||||
protected URL[] getBootPath(String base) throws MalformedURLException {
|
protected URL[] getBootPath(String base) throws MalformedURLException {
|
||||||
URL url = null;
|
URL url = null;
|
||||||
// if the given location is not null, assume it is correct and use it.
|
// if the given location is not null, assume it is correct and use it.
|
||||||
if (base != null) {
|
if (base != null) {
|
||||||
url = new URL(base);
|
url = new URL(base);
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println("Boot URL: " + url.toExternalForm());
|
System.out.println("Boot URL: " + url.toExternalForm());
|
||||||
return new URL[] {url};
|
return new URL[] {url};
|
||||||
}
|
|
||||||
// Create a URL based on the location of this class' code.
|
|
||||||
// strip off jar file and/or last directory to get
|
|
||||||
// to the directory containing projects.
|
|
||||||
URL[] result = null;
|
|
||||||
url = getClass().getProtectionDomain().getCodeSource().getLocation();
|
|
||||||
String path = url.getFile();
|
|
||||||
if (path.endsWith(".jar"))
|
|
||||||
path = path.substring(0, path.lastIndexOf("/"));
|
|
||||||
else
|
|
||||||
if (path.endsWith("/"))
|
|
||||||
path = path.substring(0, path.length() - 1);
|
|
||||||
if (inVAJ || inVAME) {
|
|
||||||
int ix = path.lastIndexOf("/");
|
|
||||||
path = path.substring(0, ix + 1);
|
|
||||||
path = path + PROJECT_NAME + "/";
|
|
||||||
url = new URL(url.getProtocol(), url.getHost(), url.getPort(), path);
|
|
||||||
result = new URL[] {url};
|
|
||||||
} else {
|
|
||||||
path = searchForPlugins(path);
|
|
||||||
path = searchForBoot(path);
|
|
||||||
// add on any dev path elements
|
|
||||||
url = new URL(url.getProtocol(), url.getHost(), url.getPort(), path);
|
|
||||||
result = getDevPath(url);
|
|
||||||
}
|
|
||||||
if (debug) {
|
|
||||||
System.out.println("Boot URL:");
|
|
||||||
for (int i = 0; i < result.length; i++)
|
|
||||||
System.out.println(" " + result[i].toExternalForm());
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Searches for a plugins root starting at a given location. If one is
|
|
||||||
* found then this location is returned; otherwise an empty string is
|
|
||||||
* returned.
|
|
||||||
*
|
|
||||||
* @return the location where plugins were found, or an empty string
|
|
||||||
* @param start the location to begin searching at
|
|
||||||
*/
|
|
||||||
protected String searchForPlugins(String start) {
|
|
||||||
File path = new File(start);
|
|
||||||
while (path != null) {
|
|
||||||
File test = new File(path, "plugins");
|
|
||||||
if (test.exists())
|
|
||||||
return test.toString();
|
|
||||||
path = path.getParentFile();
|
|
||||||
path = (path == null || path.length() == 1) ? null : path;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Searches for a boot directory starting at a given location. If one
|
|
||||||
* is found then this location is returned; otherwise an empty string
|
|
||||||
* is returned.
|
|
||||||
*
|
|
||||||
* @return the location where plugins were found, or an empty string
|
|
||||||
* @param start the location to begin searching at
|
|
||||||
*/
|
|
||||||
protected String searchForBoot(String start) {
|
|
||||||
FileFilter filter = new FileFilter() {
|
|
||||||
@Override
|
|
||||||
public boolean accept(File candidate) {
|
|
||||||
return candidate.getName().startsWith(PI_BOOT);
|
|
||||||
}
|
}
|
||||||
};
|
// Create a URL based on the location of this class' code.
|
||||||
File[] boots = new File(start).listFiles(filter);
|
// strip off jar file and/or last directory to get
|
||||||
String result = null;
|
// to the directory containing projects.
|
||||||
String maxVersion = null;
|
URL[] result = null;
|
||||||
for (int i = 0; i < boots.length; i++) {
|
url = getClass().getProtectionDomain().getCodeSource().getLocation();
|
||||||
String name = boots[i].getName();
|
String path = url.getFile();
|
||||||
int index = name.lastIndexOf('_');
|
if (path.endsWith(".jar"))
|
||||||
if (index == -1) {
|
path = path.substring(0, path.lastIndexOf("/"));
|
||||||
result = boots[i].getAbsolutePath();
|
else
|
||||||
i = boots.length;
|
if (path.endsWith("/"))
|
||||||
|
path = path.substring(0, path.length() - 1);
|
||||||
|
if (inVAJ || inVAME) {
|
||||||
|
int ix = path.lastIndexOf("/");
|
||||||
|
path = path.substring(0, ix + 1);
|
||||||
|
path = path + PROJECT_NAME + "/";
|
||||||
|
url = new URL(url.getProtocol(), url.getHost(), url.getPort(), path);
|
||||||
|
result = new URL[] {url};
|
||||||
} else {
|
} else {
|
||||||
if (index > 0) {
|
path = searchForPlugins(path);
|
||||||
String version = name.substring(index + 1);
|
path = searchForBoot(path);
|
||||||
if (maxVersion == null) {
|
// add on any dev path elements
|
||||||
result = boots[i].getAbsolutePath();
|
url = new URL(url.getProtocol(), url.getHost(), url.getPort(), path);
|
||||||
maxVersion = version;
|
result = getDevPath(url);
|
||||||
} else
|
}
|
||||||
if (maxVersion.compareTo(version) == -1) {
|
if (debug) {
|
||||||
|
System.out.println("Boot URL:");
|
||||||
|
for (int i = 0; i < result.length; i++)
|
||||||
|
System.out.println(" " + result[i].toExternalForm());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches for a plugins root starting at a given location. If one is
|
||||||
|
* found then this location is returned; otherwise an empty string is
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* @return the location where plugins were found, or an empty string
|
||||||
|
* @param start the location to begin searching at
|
||||||
|
*/
|
||||||
|
protected String searchForPlugins(String start) {
|
||||||
|
File path = new File(start);
|
||||||
|
while (path != null) {
|
||||||
|
File test = new File(path, "plugins");
|
||||||
|
if (test.exists())
|
||||||
|
return test.toString();
|
||||||
|
path = path.getParentFile();
|
||||||
|
path = (path == null || path.length() == 1) ? null : path;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Searches for a boot directory starting at a given location. If one
|
||||||
|
* is found then this location is returned; otherwise an empty string
|
||||||
|
* is returned.
|
||||||
|
*
|
||||||
|
* @return the location where plugins were found, or an empty string
|
||||||
|
* @param start the location to begin searching at
|
||||||
|
*/
|
||||||
|
protected String searchForBoot(String start) {
|
||||||
|
FileFilter filter = new FileFilter() {
|
||||||
|
@Override
|
||||||
|
public boolean accept(File candidate) {
|
||||||
|
return candidate.getName().startsWith(PI_BOOT);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
File[] boots = new File(start).listFiles(filter);
|
||||||
|
String result = null;
|
||||||
|
String maxVersion = null;
|
||||||
|
for (int i = 0; i < boots.length; i++) {
|
||||||
|
String name = boots[i].getName();
|
||||||
|
int index = name.lastIndexOf('_');
|
||||||
|
if (index == -1) {
|
||||||
|
result = boots[i].getAbsolutePath();
|
||||||
|
i = boots.length;
|
||||||
|
} else {
|
||||||
|
if (index > 0) {
|
||||||
|
String version = name.substring(index + 1);
|
||||||
|
if (maxVersion == null) {
|
||||||
result = boots[i].getAbsolutePath();
|
result = boots[i].getAbsolutePath();
|
||||||
maxVersion = version;
|
maxVersion = version;
|
||||||
}
|
} else
|
||||||
|
if (maxVersion.compareTo(version) == -1) {
|
||||||
|
result = boots[i].getAbsolutePath();
|
||||||
|
maxVersion = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (result == null)
|
||||||
|
throw new RuntimeException("Could not find bootstrap code. Check location of boot plug-in or specify -boot.");
|
||||||
|
return result.replace(File.separatorChar, '/') + "/";
|
||||||
}
|
}
|
||||||
if (result == null)
|
|
||||||
throw new RuntimeException("Could not find bootstrap code. Check location of boot plug-in or specify -boot.");
|
|
||||||
return result.replace(File.separatorChar, '/') + "/";
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the update loader for the given boot path.
|
|
||||||
*
|
|
||||||
* @return the update loader
|
|
||||||
* @param base the boot path base
|
|
||||||
* @exception Exception thrown is a problem occurs determining this loader
|
|
||||||
*/
|
|
||||||
public Class getUpdateLoader(String base) throws Exception {
|
|
||||||
URLClassLoader loader = new URLClassLoader(getBootPath(base), null);
|
|
||||||
return loader.loadClass(UPDATELOADER);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Runs the platform with the given arguments. The arguments must identify
|
|
||||||
* an application to run (e.g., <code>-application com.example.application</code>).
|
|
||||||
* After running the application <code>System.exit(N)</code> is executed.
|
|
||||||
* The value of N is derived from the value returned from running the application.
|
|
||||||
* If the application's return value is an <code>Integer</code>, N is this value.
|
|
||||||
* In all other cases, N = 0.
|
|
||||||
* <p>
|
|
||||||
* Clients wishing to run the platform without a following <code>System.exit</code>
|
|
||||||
* call should use <code>run()</code>.
|
|
||||||
*
|
|
||||||
* @see #run
|
|
||||||
*
|
|
||||||
* @param args the command line arguments
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Object result = null;
|
|
||||||
try {
|
|
||||||
result = new Main().run(args);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
// try and take down the splash screen.
|
|
||||||
endSplash();
|
|
||||||
System.out.println("Exception launching the Eclipse Platform:");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
int exitCode = result instanceof Integer ? ((Integer) result).intValue() : 0;
|
|
||||||
System.exit(exitCode);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Tears down the currently-displayed splash screen.
|
|
||||||
*/
|
|
||||||
public static void endSplash() {
|
|
||||||
if (endSplash == null)
|
|
||||||
return;
|
|
||||||
try {
|
|
||||||
Runtime.getRuntime().exec(endSplash);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs this launcher with the arguments specified in the given string.
|
* Returns the update loader for the given boot path.
|
||||||
*
|
*
|
||||||
* @param argString the arguments string
|
* @return the update loader
|
||||||
* @exception Exception thrown if a problem occurs during launching
|
* @param base the boot path base
|
||||||
*/
|
* @exception Exception thrown is a problem occurs determining this loader
|
||||||
public static void main(String argString) throws Exception {
|
*/
|
||||||
List<String> list = new ArrayList<String>(5);
|
public Class getUpdateLoader(String base) throws Exception {
|
||||||
for (StringTokenizer tokens = new StringTokenizer(argString, " "); tokens.hasMoreElements();)
|
try (URLClassLoader loader = new URLClassLoader(getBootPath(base), null)) {
|
||||||
list.add((String) tokens.nextElement());
|
return loader.loadClass(UPDATELOADER);
|
||||||
main(list.toArray(new String[list.size()]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Processes the command line arguments
|
|
||||||
*
|
|
||||||
* @return the arguments to pass through to the launched application
|
|
||||||
* @param args the command line arguments
|
|
||||||
*/
|
|
||||||
protected String[] processCommandLine(String[] args) throws Exception {
|
|
||||||
int[] configArgs = new int[100];
|
|
||||||
configArgs[0] = -1; // need to initialize the first element to something that could not be an index.
|
|
||||||
int configArgIndex = 0;
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
boolean found = false;
|
|
||||||
// check for args without parameters (i.e., a flag arg)
|
|
||||||
// check if debug should be enabled for the entire platform
|
|
||||||
if (args[i].equalsIgnoreCase(DEBUG)) {
|
|
||||||
debug = true;
|
|
||||||
// passed thru this arg (i.e., do not set found = true
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if development mode should be enabled for the entire platform
|
|
||||||
// If this is the last arg or there is a following arg (i.e., arg+1 has a leading -),
|
|
||||||
// simply enable development mode. Otherwise, assume that that the following arg is
|
|
||||||
// actually some additional development time class path entries. This will be processed below.
|
|
||||||
if (args[i].equalsIgnoreCase(DEV) && ((i + 1 == args.length) || ((i + 1 < args.length) && (args[i + 1].startsWith("-"))))) {
|
|
||||||
inDevelopmentMode = true;
|
|
||||||
// do not mark the arg as found so it will be passed through
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// done checking for args. Remember where an arg was found
|
|
||||||
if (found) {
|
|
||||||
configArgs[configArgIndex++] = i;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// check for args with parameters. If we are at the last argument or if the next one
|
|
||||||
// has a '-' as the first character, then we can't have an arg with a parm so continue.
|
|
||||||
if (i == args.length - 1 || args[i + 1].startsWith("-"))
|
|
||||||
continue;
|
|
||||||
String arg = args[++i];
|
|
||||||
|
|
||||||
// look for the laucher to run
|
|
||||||
if (args[i - 1].equalsIgnoreCase(BOOT)) {
|
|
||||||
bootLocation = arg;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// look for the development mode and class path entries.
|
|
||||||
if (args[i - 1].equalsIgnoreCase(DEV)) {
|
|
||||||
inDevelopmentMode = true;
|
|
||||||
devClassPath = arg;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// look for the application to run
|
|
||||||
if (args[i - 1].equalsIgnoreCase(APPLICATION)) {
|
|
||||||
application = arg;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// look for token to use to end the splash screen
|
|
||||||
if (args[i - 1].equalsIgnoreCase(ENDSPLASH)) {
|
|
||||||
endSplash = arg;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// look for items to uninstall
|
|
||||||
if (args[i - 1].equalsIgnoreCase(UNINSTALL)) {
|
|
||||||
uninstall = true;
|
|
||||||
uninstallCookie = arg;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// done checking for args. Remember where an arg was found
|
|
||||||
if (found) {
|
|
||||||
configArgs[configArgIndex++] = i - 1;
|
|
||||||
configArgs[configArgIndex++] = i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove all the arguments consumed by this argument parsing
|
|
||||||
if (configArgIndex == 0)
|
/**
|
||||||
return args;
|
* Runs the platform with the given arguments. The arguments must identify
|
||||||
String[] passThruArgs = new String[args.length - configArgIndex];
|
* an application to run (e.g., <code>-application com.example.application</code>).
|
||||||
configArgIndex = 0;
|
* After running the application <code>System.exit(N)</code> is executed.
|
||||||
int j = 0;
|
* The value of N is derived from the value returned from running the application.
|
||||||
for (int i = 0; i < args.length; i++) {
|
* If the application's return value is an <code>Integer</code>, N is this value.
|
||||||
if (i == configArgs[configArgIndex])
|
* In all other cases, N = 0.
|
||||||
configArgIndex++;
|
* <p>
|
||||||
|
* Clients wishing to run the platform without a following <code>System.exit</code>
|
||||||
|
* call should use <code>run()</code>.
|
||||||
|
*
|
||||||
|
* @see #run
|
||||||
|
*
|
||||||
|
* @param args the command line arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Object result = null;
|
||||||
|
try {
|
||||||
|
result = new Main().run(args);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
// try and take down the splash screen.
|
||||||
|
endSplash();
|
||||||
|
System.out.println("Exception launching the Eclipse Platform:");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
int exitCode = result instanceof Integer ? ((Integer) result).intValue() : 0;
|
||||||
|
System.exit(exitCode);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Tears down the currently-displayed splash screen.
|
||||||
|
*/
|
||||||
|
public static void endSplash() {
|
||||||
|
if (endSplash == null)
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec(endSplash);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs this launcher with the arguments specified in the given string.
|
||||||
|
*
|
||||||
|
* @param argString the arguments string
|
||||||
|
* @exception Exception thrown if a problem occurs during launching
|
||||||
|
*/
|
||||||
|
public static void main(String argString) throws Exception {
|
||||||
|
List<String> list = new ArrayList<String>(5);
|
||||||
|
for (StringTokenizer tokens = new StringTokenizer(argString, " "); tokens.hasMoreElements();)
|
||||||
|
list.add((String) tokens.nextElement());
|
||||||
|
main(list.toArray(new String[list.size()]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes the command line arguments
|
||||||
|
*
|
||||||
|
* @return the arguments to pass through to the launched application
|
||||||
|
* @param args the command line arguments
|
||||||
|
*/
|
||||||
|
protected String[] processCommandLine(String[] args) throws Exception {
|
||||||
|
int[] configArgs = new int[100];
|
||||||
|
configArgs[0] = -1; // need to initialize the first element to something that could not be an index.
|
||||||
|
int configArgIndex = 0;
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
boolean found = false;
|
||||||
|
// check for args without parameters (i.e., a flag arg)
|
||||||
|
// check if debug should be enabled for the entire platform
|
||||||
|
if (args[i].equalsIgnoreCase(DEBUG)) {
|
||||||
|
debug = true;
|
||||||
|
// passed thru this arg (i.e., do not set found = true
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if development mode should be enabled for the entire platform
|
||||||
|
// If this is the last arg or there is a following arg (i.e., arg+1 has a leading -),
|
||||||
|
// simply enable development mode. Otherwise, assume that that the following arg is
|
||||||
|
// actually some additional development time class path entries. This will be processed below.
|
||||||
|
if (args[i].equalsIgnoreCase(DEV) && ((i + 1 == args.length) || ((i + 1 < args.length) && (args[i + 1].startsWith("-"))))) {
|
||||||
|
inDevelopmentMode = true;
|
||||||
|
// do not mark the arg as found so it will be passed through
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// done checking for args. Remember where an arg was found
|
||||||
|
if (found) {
|
||||||
|
configArgs[configArgIndex++] = i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// check for args with parameters. If we are at the last argument or if the next one
|
||||||
|
// has a '-' as the first character, then we can't have an arg with a parm so continue.
|
||||||
|
if (i == args.length - 1 || args[i + 1].startsWith("-"))
|
||||||
|
continue;
|
||||||
|
String arg = args[++i];
|
||||||
|
|
||||||
|
// look for the laucher to run
|
||||||
|
if (args[i - 1].equalsIgnoreCase(BOOT)) {
|
||||||
|
bootLocation = arg;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for the development mode and class path entries.
|
||||||
|
if (args[i - 1].equalsIgnoreCase(DEV)) {
|
||||||
|
inDevelopmentMode = true;
|
||||||
|
devClassPath = arg;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for the application to run
|
||||||
|
if (args[i - 1].equalsIgnoreCase(APPLICATION)) {
|
||||||
|
application = arg;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for token to use to end the splash screen
|
||||||
|
if (args[i - 1].equalsIgnoreCase(ENDSPLASH)) {
|
||||||
|
endSplash = arg;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// look for items to uninstall
|
||||||
|
if (args[i - 1].equalsIgnoreCase(UNINSTALL)) {
|
||||||
|
uninstall = true;
|
||||||
|
uninstallCookie = arg;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// done checking for args. Remember where an arg was found
|
||||||
|
if (found) {
|
||||||
|
configArgs[configArgIndex++] = i - 1;
|
||||||
|
configArgs[configArgIndex++] = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// remove all the arguments consumed by this argument parsing
|
||||||
|
if (configArgIndex == 0)
|
||||||
|
return args;
|
||||||
|
String[] passThruArgs = new String[args.length - configArgIndex];
|
||||||
|
configArgIndex = 0;
|
||||||
|
int j = 0;
|
||||||
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
if (i == configArgs[configArgIndex])
|
||||||
|
configArgIndex++;
|
||||||
|
else
|
||||||
|
passThruArgs[j++] = args[i];
|
||||||
|
}
|
||||||
|
return passThruArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the application to be launched.
|
||||||
|
*
|
||||||
|
* @return the return value from the launched application
|
||||||
|
* @param args the arguments to pass to the application
|
||||||
|
* @exception thrown if a problem occurs during launching
|
||||||
|
*/
|
||||||
|
public Object run(String[] args) throws Exception {
|
||||||
|
String[] passThruArgs = processCommandLine(args);
|
||||||
|
if (uninstall)
|
||||||
|
return updateRun(UNINSTALL, uninstallCookie, passThruArgs);
|
||||||
else
|
else
|
||||||
passThruArgs[j++] = args[i];
|
return basicRun(passThruArgs);
|
||||||
}
|
}
|
||||||
return passThruArgs;
|
|
||||||
}
|
/**
|
||||||
/**
|
* Performs an update run.
|
||||||
* Runs the application to be launched.
|
*
|
||||||
*
|
* @return the return value from the update loader
|
||||||
* @return the return value from the launched application
|
* @param flag flag to give to the update loader
|
||||||
* @param args the arguments to pass to the application
|
* @param value value to give to the update loader
|
||||||
* @exception thrown if a problem occurs during launching
|
* @param args arguments to give to the update loader.
|
||||||
*/
|
* @exception Exception thrown if a problem occurs during execution
|
||||||
public Object run(String[] args) throws Exception {
|
*/
|
||||||
String[] passThruArgs = processCommandLine(args);
|
protected Object updateRun(String flag, String value, String[] args) throws Exception {
|
||||||
if (uninstall)
|
Class clazz = getUpdateLoader(bootLocation);
|
||||||
return updateRun(UNINSTALL, uninstallCookie, passThruArgs);
|
Method method = clazz.getDeclaredMethod("run", new Class[] { String.class, String.class, String.class, String[].class });
|
||||||
else
|
try {
|
||||||
return basicRun(passThruArgs);
|
return method.invoke(clazz, new Object[] { flag, value, location, args });
|
||||||
}
|
} catch (InvocationTargetException e) {
|
||||||
/**
|
if (e.getTargetException() instanceof Error)
|
||||||
* Performs an update run.
|
throw (Error) e.getTargetException();
|
||||||
*
|
else
|
||||||
* @return the return value from the update loader
|
throw e;
|
||||||
* @param flag flag to give to the update loader
|
}
|
||||||
* @param value value to give to the update loader
|
|
||||||
* @param args arguments to give to the update loader.
|
|
||||||
* @exception Exception thrown if a problem occurs during execution
|
|
||||||
*/
|
|
||||||
protected Object updateRun(String flag, String value, String[] args) throws Exception {
|
|
||||||
Class clazz = getUpdateLoader(bootLocation);
|
|
||||||
Method method = clazz.getDeclaredMethod("run", new Class[] { String.class, String.class, String.class, String[].class });
|
|
||||||
try {
|
|
||||||
return method.invoke(clazz, new Object[] { flag, value, location, args });
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
if (e.getTargetException() instanceof Error)
|
|
||||||
throw (Error) e.getTargetException();
|
|
||||||
else
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class TestScannerProvider extends AbstractCExtension implements IScannerI
|
||||||
public static String[] sIncludes;
|
public static String[] sIncludes;
|
||||||
public static String[] sIncludeFiles;
|
public static String[] sIncludeFiles;
|
||||||
public static String[] sMacroFiles;
|
public static String[] sMacroFiles;
|
||||||
public static Map<String, String> sDefinedSymbols = new HashMap<String, String>();
|
public static Map<String, String> sDefinedSymbols = new HashMap<>();
|
||||||
public final static String SCANNER_ID = CTestPlugin.PLUGIN_ID + ".TestScanner";
|
public final static String SCANNER_ID = CTestPlugin.PLUGIN_ID + ".TestScanner";
|
||||||
|
|
||||||
public static void clear() {
|
public static void clear() {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.settings.model;
|
package org.eclipse.cdt.core.settings.model;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.settings.model;
|
package org.eclipse.cdt.core.settings.model;
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ import org.eclipse.core.runtime.IPath;
|
||||||
/**
|
/**
|
||||||
* Helper interface capturing 'path' characteristic for {@link ICSettingEntry}
|
* Helper interface capturing 'path' characteristic for {@link ICSettingEntry}
|
||||||
* and {@link ICLanguageSettingEntry} interfaces.
|
* and {@link ICLanguageSettingEntry} interfaces.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface ICPathEntry extends ICSettingEntry {
|
public interface ICPathEntry extends ICSettingEntry {
|
||||||
IPath getFullPath();
|
IPath getFullPath();
|
||||||
|
@ -23,5 +22,4 @@ public interface ICPathEntry extends ICSettingEntry {
|
||||||
IPath getLocation();
|
IPath getLocation();
|
||||||
|
|
||||||
boolean isValueWorkspacePath();
|
boolean isValueWorkspacePath();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,8 +33,7 @@ public interface IPDOMIndexer {
|
||||||
public ICProject getProject();
|
public ICProject getProject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the unique ID of type of this indexer
|
* Returns the unique ID of type of this indexer
|
||||||
* @return the unique ID of type of this indexer
|
|
||||||
*/
|
*/
|
||||||
public String getID();
|
public String getID();
|
||||||
|
|
||||||
|
|
|
@ -18,29 +18,23 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IASTComment extends IASTNode {
|
public interface IASTComment extends IASTNode {
|
||||||
/**
|
/** @since 5.4 */
|
||||||
* @since 5.4
|
|
||||||
*/
|
|
||||||
public final IASTComment[] EMPTY_COMMENT_ARRAY = {};
|
public final IASTComment[] EMPTY_COMMENT_ARRAY = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the comment.
|
* Sets the comment.
|
||||||
*
|
*
|
||||||
* @param comment
|
* @param comment the text of the comment
|
||||||
*/
|
*/
|
||||||
public void setComment(char[] comment);
|
public void setComment(char[] comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a char array representation of the comment.
|
* Returns a char array representation of the comment.
|
||||||
*
|
|
||||||
* @return char array representation of the comment
|
|
||||||
*/
|
*/
|
||||||
public char[] getComment();
|
public char[] getComment();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if this is a blockcomment.
|
* Returns true if this is a block comment.
|
||||||
*
|
|
||||||
* @return true if this is a blockcomment
|
|
||||||
*/
|
*/
|
||||||
public boolean isBlockComment();
|
public boolean isBlockComment();
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,7 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
|
||||||
if (fLocationResolver != null) {
|
if (fLocationResolver != null) {
|
||||||
return fLocationResolver.getComments();
|
return fLocationResolver.getComments();
|
||||||
}
|
}
|
||||||
return new IASTComment[0];
|
return IASTComment.EMPTY_COMMENT_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class CIndex implements IIndex {
|
||||||
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
||||||
return fFragments[0].findBindings(patterns, isFullyQualified, filter, monitor);
|
return fFragments[0].findBindings(patterns, isFullyQualified, filter, monitor);
|
||||||
} else {
|
} else {
|
||||||
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
|
List<IIndexBinding[]> result = new ArrayList<>();
|
||||||
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
||||||
for (ILinkage linkage : linkages) {
|
for (ILinkage linkage : linkages) {
|
||||||
if (filter.acceptLinkage(linkage)) {
|
if (filter.acceptLinkage(linkage)) {
|
||||||
|
@ -134,7 +134,7 @@ public class CIndex implements IIndex {
|
||||||
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
||||||
return fFragments[0].findMacroContainers(pattern, filter, monitor);
|
return fFragments[0].findMacroContainers(pattern, filter, monitor);
|
||||||
} else {
|
} else {
|
||||||
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
|
List<IIndexBinding[]> result = new ArrayList<>();
|
||||||
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
||||||
for (ILinkage linkage : linkages) {
|
for (ILinkage linkage : linkages) {
|
||||||
if (filter.acceptLinkage(linkage)) {
|
if (filter.acceptLinkage(linkage)) {
|
||||||
|
@ -160,14 +160,14 @@ public class CIndex implements IIndex {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexName[] findNames(IBinding binding, int flags) throws CoreException {
|
public IIndexName[] findNames(IBinding binding, int flags) throws CoreException {
|
||||||
ArrayList<IIndexFragmentName> result= new ArrayList<IIndexFragmentName>();
|
ArrayList<IIndexFragmentName> result= new ArrayList<>();
|
||||||
if (binding instanceof ICPPUsingDeclaration) {
|
if (binding instanceof ICPPUsingDeclaration) {
|
||||||
IBinding[] bindings= ((ICPPUsingDeclaration) binding).getDelegates();
|
IBinding[] bindings= ((ICPPUsingDeclaration) binding).getDelegates();
|
||||||
if (bindings == null || bindings.length == 0) {
|
if (bindings == null || bindings.length == 0) {
|
||||||
return new IIndexName[0];
|
return IIndexName.EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
if (bindings.length > 1) {
|
if (bindings.length > 1) {
|
||||||
ArrayList<IIndexName> multi= new ArrayList<IIndexName>();
|
ArrayList<IIndexName> multi= new ArrayList<>();
|
||||||
for (IBinding b : bindings) {
|
for (IBinding b : bindings) {
|
||||||
multi.addAll(Arrays.asList(findNames(b, flags)));
|
multi.addAll(Arrays.asList(findNames(b, flags)));
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ public class CIndex implements IIndex {
|
||||||
// Read only fragments can be superseded by what the indexer writes into
|
// Read only fragments can be superseded by what the indexer writes into
|
||||||
// a writable fragment. Therefore names from a read-only fragment are
|
// a writable fragment. Therefore names from a read-only fragment are
|
||||||
// ignored if there is a match in a writable fragment.
|
// ignored if there is a match in a writable fragment.
|
||||||
HashSet<NameKey> encounteredNames = new HashSet<NameKey>();
|
HashSet<NameKey> encounteredNames = new HashSet<>();
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
if (fragment instanceof IWritableIndexFragment) {
|
if (fragment instanceof IWritableIndexFragment) {
|
||||||
final IIndexFragmentName[] names = fragment.findNames(binding, flags);
|
final IIndexFragmentName[] names = fragment.findNames(binding, flags);
|
||||||
|
@ -250,8 +250,8 @@ public class CIndex implements IIndex {
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
return IIndexFile.EMPTY_FILE_ARRAY;
|
return IIndexFile.EMPTY_FILE_ARRAY;
|
||||||
}
|
}
|
||||||
Set<ISignificantMacros> handled = new HashSet<ISignificantMacros>();
|
Set<ISignificantMacros> handled = new HashSet<>();
|
||||||
ArrayList<IIndexFragmentFile> result= new ArrayList<IIndexFragmentFile>();
|
ArrayList<IIndexFragmentFile> result= new ArrayList<>();
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
IIndexFragmentFile[] candidates= fragment.getFiles(linkageID, location);
|
IIndexFragmentFile[] candidates= fragment.getFiles(linkageID, location);
|
||||||
for (IIndexFragmentFile candidate : candidates) {
|
for (IIndexFragmentFile candidate : candidates) {
|
||||||
|
@ -274,8 +274,8 @@ public class CIndex implements IIndex {
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
return IIndexFile.EMPTY_FILE_ARRAY;
|
return IIndexFile.EMPTY_FILE_ARRAY;
|
||||||
}
|
}
|
||||||
Set<FileContentKey> keys = new HashSet<FileContentKey>();
|
Set<FileContentKey> keys = new HashSet<>();
|
||||||
ArrayList<IIndexFragmentFile> result= new ArrayList<IIndexFragmentFile>();
|
ArrayList<IIndexFragmentFile> result= new ArrayList<>();
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
IIndexFragmentFile[] candidates= fragment.getFiles(location);
|
IIndexFragmentFile[] candidates= fragment.getFiles(location);
|
||||||
for (IIndexFragmentFile candidate : candidates) {
|
for (IIndexFragmentFile candidate : candidates) {
|
||||||
|
@ -313,7 +313,7 @@ public class CIndex implements IIndex {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexInclude[] findIncludedBy(IIndexFile file, int depth) throws CoreException {
|
public IIndexInclude[] findIncludedBy(IIndexFile file, int depth) throws CoreException {
|
||||||
List<IIndexInclude> result= new ArrayList<IIndexInclude>();
|
List<IIndexInclude> result= new ArrayList<>();
|
||||||
findIncludedBy(file.getLinkageID(), Collections.singletonList(file), result, depth,
|
findIncludedBy(file.getLinkageID(), Collections.singletonList(file), result, depth,
|
||||||
new HashSet<FileContentKey>());
|
new HashSet<FileContentKey>());
|
||||||
return result.toArray(new IIndexInclude[result.size()]);
|
return result.toArray(new IIndexInclude[result.size()]);
|
||||||
|
@ -354,8 +354,8 @@ public class CIndex implements IIndex {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexInclude[] findIncludes(IIndexFile file, int depth) throws CoreException {
|
public IIndexInclude[] findIncludes(IIndexFile file, int depth) throws CoreException {
|
||||||
List<IIndexInclude> result= new ArrayList<IIndexInclude>();
|
List<IIndexInclude> result= new ArrayList<>();
|
||||||
findIncludes(Collections.singletonList(file), result, depth, new HashSet<Object>());
|
findIncludes(Collections.singletonList(file), result, depth, new HashSet<>());
|
||||||
return result.toArray(new IIndexInclude[result.size()]);
|
return result.toArray(new IIndexInclude[result.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ public class CIndex implements IIndex {
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor= new NullProgressMonitor();
|
monitor= new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
|
List<IIndexBinding[]> result = new ArrayList<>();
|
||||||
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
||||||
monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length * linkages.length);
|
monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length * linkages.length);
|
||||||
for (ILinkage linkage : linkages) {
|
for (ILinkage linkage : linkages) {
|
||||||
|
@ -529,7 +529,7 @@ public class CIndex implements IIndex {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIndexFragmentBinding[] findEquivalentBindings(IBinding binding) throws CoreException {
|
public IIndexFragmentBinding[] findEquivalentBindings(IBinding binding) throws CoreException {
|
||||||
List<IIndexFragmentBinding> result = new ArrayList<IIndexFragmentBinding>();
|
List<IIndexFragmentBinding> result = new ArrayList<>();
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
IIndexFragmentBinding adapted = fragment.adaptBinding(binding);
|
IIndexFragmentBinding adapted = fragment.adaptBinding(binding);
|
||||||
if (adapted != null) {
|
if (adapted != null) {
|
||||||
|
@ -583,7 +583,7 @@ public class CIndex implements IIndex {
|
||||||
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
||||||
return fFragments[0].findBindingsForPrefix(prefix, filescope, filter, monitor);
|
return fFragments[0].findBindingsForPrefix(prefix, filescope, filter, monitor);
|
||||||
} else {
|
} else {
|
||||||
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
|
List<IIndexBinding[]> result = new ArrayList<>();
|
||||||
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
||||||
for (ILinkage linkage : linkages) {
|
for (ILinkage linkage : linkages) {
|
||||||
if (filter.acceptLinkage(linkage)) {
|
if (filter.acceptLinkage(linkage)) {
|
||||||
|
@ -613,7 +613,7 @@ public class CIndex implements IIndex {
|
||||||
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
||||||
return fFragments[0].findBindingsForContentAssist(prefix, filescope, filter, monitor);
|
return fFragments[0].findBindingsForContentAssist(prefix, filescope, filter, monitor);
|
||||||
} else {
|
} else {
|
||||||
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
|
List<IIndexBinding[]> result = new ArrayList<>();
|
||||||
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
||||||
for (ILinkage linkage : linkages) {
|
for (ILinkage linkage : linkages) {
|
||||||
if (filter.acceptLinkage(linkage)) {
|
if (filter.acceptLinkage(linkage)) {
|
||||||
|
@ -643,7 +643,7 @@ public class CIndex implements IIndex {
|
||||||
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
if (SPECIALCASE_SINGLES && fFragments.length == 1) {
|
||||||
return fFragments[0].findBindings(name, filescope, filter, monitor);
|
return fFragments[0].findBindings(name, filescope, filter, monitor);
|
||||||
} else {
|
} else {
|
||||||
List<IIndexBinding[]> result = new ArrayList<IIndexBinding[]>();
|
List<IIndexBinding[]> result = new ArrayList<>();
|
||||||
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
ILinkage[] linkages = Linkage.getIndexerLinkages();
|
||||||
for (ILinkage linkage : linkages) {
|
for (ILinkage linkage : linkages) {
|
||||||
if (filter.acceptLinkage(linkage)) {
|
if (filter.acceptLinkage(linkage)) {
|
||||||
|
@ -685,11 +685,11 @@ public class CIndex implements IIndex {
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor= new NullProgressMonitor();
|
monitor= new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
List<IIndexMacro> result = new ArrayList<IIndexMacro>();
|
List<IIndexMacro> result = new ArrayList<>();
|
||||||
HashSet<IIndexFileLocation> handledIFLs= new HashSet<IIndexFileLocation>();
|
HashSet<IIndexFileLocation> handledIFLs= new HashSet<>();
|
||||||
monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length);
|
monitor.beginTask(Messages.CIndex_FindBindingsTask_label, fFragments.length);
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
HashSet<IIndexFile> allowedFiles= new HashSet<IIndexFile>();
|
HashSet<IIndexFile> allowedFiles= new HashSet<>();
|
||||||
try {
|
try {
|
||||||
IIndexMacro[] macros= fragment.findMacros(name, isPrefix, caseSensitive, filter,
|
IIndexMacro[] macros= fragment.findMacros(name, isPrefix, caseSensitive, filter,
|
||||||
new SubProgressMonitor(monitor, 1));
|
new SubProgressMonitor(monitor, 1));
|
||||||
|
@ -747,7 +747,7 @@ public class CIndex implements IIndex {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexFile[] getAllFiles() throws CoreException {
|
public IIndexFile[] getAllFiles() throws CoreException {
|
||||||
HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<IIndexFileLocation, IIndexFile>();
|
HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<>();
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
for (IIndexFragmentFile file : fragment.getAllFiles()) {
|
for (IIndexFragmentFile file : fragment.getAllFiles()) {
|
||||||
if (file.hasContent()) {
|
if (file.hasContent()) {
|
||||||
|
@ -760,7 +760,7 @@ public class CIndex implements IIndex {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexFile[] getDefectiveFiles() throws CoreException {
|
public IIndexFile[] getDefectiveFiles() throws CoreException {
|
||||||
HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<IIndexFileLocation, IIndexFile>();
|
HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<>();
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
for (IIndexFragmentFile file : fragment.getDefectiveFiles()) {
|
for (IIndexFragmentFile file : fragment.getDefectiveFiles()) {
|
||||||
if (file.hasContent()) {
|
if (file.hasContent()) {
|
||||||
|
@ -773,7 +773,7 @@ public class CIndex implements IIndex {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndexFile[] getFilesWithUnresolvedIncludes() throws CoreException {
|
public IIndexFile[] getFilesWithUnresolvedIncludes() throws CoreException {
|
||||||
HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<IIndexFileLocation, IIndexFile>();
|
HashMap<IIndexFileLocation, IIndexFile> result= new HashMap<>();
|
||||||
for (IIndexFragment fragment : fFragments) {
|
for (IIndexFragment fragment : fFragments) {
|
||||||
for (IIndexFragmentFile file : fragment.getFilesWithUnresolvedIncludes()) {
|
for (IIndexFragmentFile file : fragment.getFilesWithUnresolvedIncludes()) {
|
||||||
if (file.hasContent()) {
|
if (file.hasContent()) {
|
||||||
|
|
|
@ -40,19 +40,19 @@ public interface IIndexFragmentFile extends IIndexFile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the hash-code computed by combining the file size and the file encoding.
|
* Returns the hash-code computed by combining the file size and the file encoding.
|
||||||
* @return hashcode a hash-code or <code>0</code> if it is unknown.
|
* @return a hash-code or {@code 0} if it is unknown.
|
||||||
*/
|
*/
|
||||||
int getSizeAndEncodingHashcode() throws CoreException;
|
int getSizeAndEncodingHashcode() throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the hash-code computed by combining the file size and the file encoding.
|
* Sets the hash-code computed by combining the file size and the file encoding.
|
||||||
* @param hashcode a hash-code or <code>0</code> if it is unknown.
|
* @param hashcode a hash-code or {@code 0} if it is unknown.
|
||||||
*/
|
*/
|
||||||
void setSizeAndEncodingHashcode(int hashcode) throws CoreException;
|
void setSizeAndEncodingHashcode(int hashcode) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the flag that determines whether the file is a header with #pragma once statement
|
* Sets the flag that determines whether the file is a header with {@code #pragma once}
|
||||||
* or an include guard, or it is a source file and parsed only once because of that.
|
* statement or an include guard, or it is a source file and parsed only once because of that.
|
||||||
*/
|
*/
|
||||||
void setPragmaOnceSemantics(boolean value) throws CoreException;
|
void setPragmaOnceSemantics(boolean value) throws CoreException;
|
||||||
|
|
||||||
|
@ -85,5 +85,4 @@ public interface IIndexFragmentFile extends IIndexFile {
|
||||||
* The file 'source' must belong to the same fragment as this file.
|
* The file 'source' must belong to the same fragment as this file.
|
||||||
*/
|
*/
|
||||||
void transferContext(IIndexFragmentFile source) throws CoreException;
|
void transferContext(IIndexFragmentFile source) throws CoreException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1057,16 +1057,12 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
writeToIndex(lang.getLinkageID(), ast, codeReader, ctx, pm);
|
writeToIndex(lang.getLinkageID(), ast, codeReader, ctx, pm);
|
||||||
resultCacheCleared = true; // The cache was cleared while writing to the index.
|
resultCacheCleared = true; // The cache was cleared while writing to the index.
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
th= e;
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
final Throwable cause = e.getCause();
|
final Throwable cause = e.getCause();
|
||||||
if (cause instanceof DependsOnOutdatedFileException)
|
if (cause instanceof DependsOnOutdatedFileException)
|
||||||
return (DependsOnOutdatedFileException) cause;
|
return (DependsOnOutdatedFileException) cause;
|
||||||
th= e;
|
th= e;
|
||||||
} catch (StackOverflowError e) {
|
} catch (StackOverflowError | CoreException | AssertionError e) {
|
||||||
th= e;
|
|
||||||
} catch (AssertionError e) {
|
|
||||||
th= e;
|
th= e;
|
||||||
} catch (OutOfMemoryError e) {
|
} catch (OutOfMemoryError e) {
|
||||||
if (--fSwallowOutOfMemoryError < 0)
|
if (--fSwallowOutOfMemoryError < 0)
|
||||||
|
@ -1247,16 +1243,10 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
|
||||||
if (storageLinkageID != ILinkage.NO_LINKAGE_ID)
|
if (storageLinkageID != ILinkage.NO_LINKAGE_ID)
|
||||||
addSymbols(data, storageLinkageID, ctx, fTodoTaskUpdater, pm);
|
addSymbols(data, storageLinkageID, ctx, fTodoTaskUpdater, pm);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException | RuntimeException | Error e) {
|
||||||
// Avoid parsing files again, that caused an exception to be thrown.
|
// Avoid parsing files again, that caused an exception to be thrown.
|
||||||
withdrawRequests(linkageID, fileKeys);
|
withdrawRequests(linkageID, fileKeys);
|
||||||
throw e;
|
throw e;
|
||||||
} catch (RuntimeException e) {
|
|
||||||
withdrawRequests(linkageID, fileKeys);
|
|
||||||
throw e;
|
|
||||||
} catch (Error e) {
|
|
||||||
withdrawRequests(linkageID, fileKeys);
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Sergey Prigogin (Google) - initial API and implementation
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom;
|
package org.eclipse.cdt.internal.core.pdom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
import org.eclipse.cdt.core.dom.ast.IASTComment;
|
||||||
|
|
|
@ -135,26 +135,27 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
|
||||||
public static int SKIP_NO_REFERENCES= 0;
|
public static int SKIP_NO_REFERENCES= 0;
|
||||||
|
|
||||||
private static class Symbols {
|
private static class Symbols {
|
||||||
final ArrayList<IASTName[]> fNames= new ArrayList<IASTName[]>();
|
final ArrayList<IASTName[]> fNames= new ArrayList<>();
|
||||||
final ArrayList<IASTPreprocessorStatement> fMacros= new ArrayList<IASTPreprocessorStatement>();
|
final ArrayList<IASTPreprocessorStatement> fMacros= new ArrayList<>();
|
||||||
final ArrayList<IASTPreprocessorIncludeStatement> fIncludes= new ArrayList<IASTPreprocessorIncludeStatement>();
|
final ArrayList<IASTPreprocessorIncludeStatement> fIncludes= new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class Data implements IIndexSymbols {
|
protected static class Data implements IIndexSymbols {
|
||||||
final IASTTranslationUnit fAST;
|
final IASTTranslationUnit fAST;
|
||||||
final FileInAST[] fSelectedFiles;
|
final FileInAST[] fSelectedFiles;
|
||||||
final IWritableIndex fIndex;
|
final IWritableIndex fIndex;
|
||||||
final Map<IASTPreprocessorIncludeStatement, Symbols> fSymbolMap = new HashMap<IASTPreprocessorIncludeStatement, Symbols>();
|
final Map<IASTPreprocessorIncludeStatement, Symbols> fSymbolMap = new HashMap<>();
|
||||||
final Set<IASTPreprocessorIncludeStatement> fContextIncludes = new HashSet<IASTPreprocessorIncludeStatement>();
|
final Set<IASTPreprocessorIncludeStatement> fContextIncludes = new HashSet<>();
|
||||||
final List<IStatus> fStati= new ArrayList<IStatus>();
|
final List<IStatus> fStatuses= new ArrayList<>();
|
||||||
|
|
||||||
public Data(IASTTranslationUnit ast, FileInAST[] selectedFiles, IWritableIndex index) {
|
public Data(IASTTranslationUnit ast, FileInAST[] selectedFiles, IWritableIndex index) {
|
||||||
fAST= ast;
|
fAST= ast;
|
||||||
fSelectedFiles= selectedFiles;
|
fSelectedFiles= selectedFiles;
|
||||||
fIndex= index;
|
fIndex= index;
|
||||||
|
|
||||||
for(FileInAST file : selectedFiles)
|
for (FileInAST file : selectedFiles) {
|
||||||
fSymbolMap.put(file.includeStatement, new Symbols());
|
fSymbolMap.put(file.includeStatement, new Symbols());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -175,7 +176,7 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
|
||||||
public void add(IASTPreprocessorIncludeStatement owner, IASTName name, IASTName caller) {
|
public void add(IASTPreprocessorIncludeStatement owner, IASTName name, IASTName caller) {
|
||||||
Symbols lists= fSymbolMap.get(owner);
|
Symbols lists= fSymbolMap.get(owner);
|
||||||
if (lists != null)
|
if (lists != null)
|
||||||
lists.fNames.add(new IASTName[]{ name, caller });
|
lists.fNames.add(new IASTName[] { name, caller });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -272,14 +273,14 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
|
||||||
|
|
||||||
// Tasks update.
|
// Tasks update.
|
||||||
if (taskUpdater != null) {
|
if (taskUpdater != null) {
|
||||||
Set<IIndexFileLocation> locations= new HashSet<IIndexFileLocation>();
|
Set<IIndexFileLocation> locations= new HashSet<>();
|
||||||
for (FileInAST file : data.fSelectedFiles) {
|
for (FileInAST file : data.fSelectedFiles) {
|
||||||
locations.add(file.fileContentKey.getLocation());
|
locations.add(file.fileContentKey.getLocation());
|
||||||
}
|
}
|
||||||
taskUpdater.updateTasks(data.fAST.getComments(), locations.toArray(new IIndexFileLocation[locations.size()]));
|
taskUpdater.updateTasks(data.fAST.getComments(), locations.toArray(new IIndexFileLocation[locations.size()]));
|
||||||
}
|
}
|
||||||
if (!data.fStati.isEmpty()) {
|
if (!data.fStatuses.isEmpty()) {
|
||||||
List<IStatus> stati = data.fStati;
|
List<IStatus> stati = data.fStatuses;
|
||||||
String path= null;
|
String path= null;
|
||||||
if (data.fSelectedFiles.length > 0) {
|
if (data.fSelectedFiles.length > 0) {
|
||||||
path= data.fSelectedFiles[data.fSelectedFiles.length - 1].fileContentKey.getLocation().getURI().getPath();
|
path= data.fSelectedFiles[data.fSelectedFiles.length - 1].fileContentKey.getLocation().getURI().getPath();
|
||||||
|
@ -352,7 +353,7 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
|
||||||
lock.release();
|
lock.release();
|
||||||
}
|
}
|
||||||
if (th != null) {
|
if (th != null) {
|
||||||
data.fStati.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing,
|
data.fStatuses.add(createStatus(NLS.bind(Messages.PDOMWriter_errorWhileParsing,
|
||||||
fileInAST.fileContentKey.getLocation().getURI().getPath()), th));
|
fileInAST.fileContentKey.getLocation().getURI().getPath()), th));
|
||||||
}
|
}
|
||||||
fStatistics.fAddToIndexTime += lock.getCumulativeLockTime();
|
fStatistics.fAddToIndexTime += lock.getCumulativeLockTime();
|
||||||
|
@ -414,7 +415,7 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
|
||||||
}
|
}
|
||||||
if (th != null) {
|
if (th != null) {
|
||||||
if (!reported) {
|
if (!reported) {
|
||||||
data.fStati.add(CCorePlugin.createStatus(NLS.bind(Messages.PDOMWriter_errorResolvingName,
|
data.fStatuses.add(CCorePlugin.createStatus(NLS.bind(Messages.PDOMWriter_errorResolvingName,
|
||||||
name.toString(), file.fileContentKey.getLocation().getURI().getPath()), th));
|
name.toString(), file.fileContentKey.getLocation().getURI().getPath()), th));
|
||||||
}
|
}
|
||||||
reported= true;
|
reported= true;
|
||||||
|
@ -593,7 +594,7 @@ abstract public class PDOMWriter implements IPDOMASTProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<IncludeInformation> includeInfos= new ArrayList<IncludeInformation>();
|
List<IncludeInformation> includeInfos= new ArrayList<>();
|
||||||
for (int i= 0; i < lists.fIncludes.size(); i++) {
|
for (int i= 0; i < lists.fIncludes.size(); i++) {
|
||||||
final IASTPreprocessorIncludeStatement stmt = lists.fIncludes.get(i);
|
final IASTPreprocessorIncludeStatement stmt = lists.fIncludes.get(i);
|
||||||
if (!stmt.isResolved()) {
|
if (!stmt.isResolved()) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class ShortString implements IString {
|
||||||
final int n = chars.length;
|
final int n = chars.length;
|
||||||
this.db = db;
|
this.db = db;
|
||||||
|
|
||||||
this.record = db.malloc(CHARS + (useBytes ? n : 2*n));
|
this.record = db.malloc(CHARS + (useBytes ? n : 2 * n));
|
||||||
Chunk chunk = db.getChunk(record);
|
Chunk chunk = db.getChunk(record);
|
||||||
chunk.putInt(record + LENGTH, useBytes ? -n : n);
|
chunk.putInt(record + LENGTH, useBytes ? -n : n);
|
||||||
long p = record + CHARS;
|
long p = record + CHARS;
|
||||||
|
@ -134,7 +134,7 @@ public class ShortString implements IString {
|
||||||
chars = getChars();
|
chars = getChars();
|
||||||
final int len = chars.length;
|
final int len = chars.length;
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
h = 31*h + chars[i];
|
h = 31 * h + chars[i];
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ public class ShortString implements IString {
|
||||||
|
|
||||||
public static int compare(final char[] chars, char[] other, boolean caseSensitive) {
|
public static int compare(final char[] chars, char[] other, boolean caseSensitive) {
|
||||||
final int n = Math.min(chars.length, other.length);
|
final int n = Math.min(chars.length, other.length);
|
||||||
for (int i=0; i<n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
int cmp= compareChars(chars[i], other[i], caseSensitive);
|
int cmp= compareChars(chars[i], other[i], caseSensitive);
|
||||||
if (cmp != 0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
@ -182,7 +182,7 @@ public class ShortString implements IString {
|
||||||
final int n = Math.min(chars.length, other.length);
|
final int n = Math.min(chars.length, other.length);
|
||||||
int sensitiveCmp= 0;
|
int sensitiveCmp= 0;
|
||||||
|
|
||||||
for (int i=0; i<n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
final char c1= chars[i];
|
final char c1= chars[i];
|
||||||
final char c2= other[i];
|
final char c2= other[i];
|
||||||
if (c1 != c2) {
|
if (c1 != c2) {
|
||||||
|
@ -214,7 +214,7 @@ public class ShortString implements IString {
|
||||||
public static int comparePrefix(final char[] chars, char[] other, boolean caseSensitive) {
|
public static int comparePrefix(final char[] chars, char[] other, boolean caseSensitive) {
|
||||||
final int n = Math.min(chars.length, other.length);
|
final int n = Math.min(chars.length, other.length);
|
||||||
|
|
||||||
for (int i=0; i<n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
int cmp= compareChars(chars[i], other[i], caseSensitive);
|
int cmp= compareChars(chars[i], other[i], caseSensitive);
|
||||||
if (cmp != 0)
|
if (cmp != 0)
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
|
@ -48,14 +48,15 @@ import com.ibm.icu.text.NumberFormat;
|
||||||
* Configures the abstract indexer task suitable for indexing projects.
|
* Configures the abstract indexer task suitable for indexing projects.
|
||||||
*/
|
*/
|
||||||
public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPDOMIndexerTask {
|
public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPDOMIndexerTask {
|
||||||
private static final String TRUE = "true"; //$NON-NLS-1$
|
private static final String TRUE = Boolean.TRUE.toString();
|
||||||
|
|
||||||
private AbstractPDOMIndexer fIndexer;
|
private AbstractPDOMIndexer fIndexer;
|
||||||
private boolean fWriteInfoToLog;
|
private boolean fWriteInfoToLog;
|
||||||
|
|
||||||
protected PDOMIndexerTask(ITranslationUnit[] forceFiles, ITranslationUnit[] updateFiles,
|
protected PDOMIndexerTask(ITranslationUnit[] forceFiles, ITranslationUnit[] updateFiles,
|
||||||
ITranslationUnit[] removeFiles, AbstractPDOMIndexer indexer, boolean isFastIndexer) {
|
ITranslationUnit[] removeFiles, AbstractPDOMIndexer indexer, boolean isFastIndexer) {
|
||||||
super(concat(forceFiles, updateFiles), removeFiles, new ProjectIndexerInputAdapter(indexer.getProject()), isFastIndexer);
|
super(concat(forceFiles, updateFiles), removeFiles, new ProjectIndexerInputAdapter(indexer.getProject()),
|
||||||
|
isFastIndexer);
|
||||||
fIndexer= indexer;
|
fIndexer= indexer;
|
||||||
setShowActivity(checkDebugOption(TRACE_ACTIVITY, TRUE));
|
setShowActivity(checkDebugOption(TRACE_ACTIVITY, TRUE));
|
||||||
setShowInclusionProblems(checkDebugOption(TRACE_INCLUSION_PROBLEMS, TRUE));
|
setShowInclusionProblems(checkDebugOption(TRACE_INCLUSION_PROBLEMS, TRUE));
|
||||||
|
@ -105,7 +106,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ITranslationUnit[] concat(ITranslationUnit[] added, ITranslationUnit[] changed) {
|
private static ITranslationUnit[] concat(ITranslationUnit[] added, ITranslationUnit[] changed) {
|
||||||
HashSet<ITranslationUnit> union = new HashSet<ITranslationUnit>(added.length + changed.length);
|
HashSet<ITranslationUnit> union = new HashSet<>(added.length + changed.length);
|
||||||
union.addAll(Arrays.asList(added));
|
union.addAll(Arrays.asList(added));
|
||||||
union.addAll(Arrays.asList(changed));
|
union.addAll(Arrays.asList(changed));
|
||||||
final ITranslationUnit[] result = union.toArray(new ITranslationUnit[union.size()]);
|
final ITranslationUnit[] result = union.toArray(new ITranslationUnit[union.size()]);
|
||||||
|
@ -166,7 +167,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
private Set<String> getStringSet(String key) {
|
private Set<String> getStringSet(String key) {
|
||||||
String prefSetting = getIndexer().getProperty(key);
|
String prefSetting = getIndexer().getProperty(key);
|
||||||
if (prefSetting != null && !prefSetting.isEmpty()) {
|
if (prefSetting != null && !prefSetting.isEmpty()) {
|
||||||
return new HashSet<String>(Arrays.asList(prefSetting.split(","))); //$NON-NLS-1$
|
return new HashSet<>(Arrays.asList(prefSetting.split(","))); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
|
@ -249,7 +250,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
|
|
||||||
// tracing
|
// tracing
|
||||||
if (checkDebugOption(IPDOMIndexerTask.TRACE_STATISTICS, TRUE)) {
|
if (checkDebugOption(IPDOMIndexerTask.TRACE_STATISTICS, TRUE)) {
|
||||||
String ident= " "; //$NON-NLS-1$
|
String indent= " "; //$NON-NLS-1$
|
||||||
final long totalTime = System.currentTimeMillis() - start;
|
final long totalTime = System.currentTimeMillis() - start;
|
||||||
final IndexerProgress info= getProgressInformation();
|
final IndexerProgress info= getProgressInformation();
|
||||||
final int sum= fStatistics.fDeclarationCount + fStatistics.fReferenceCount + fStatistics.fProblemBindingCount;
|
final int sum= fStatistics.fDeclarationCount + fStatistics.fReferenceCount + fStatistics.fProblemBindingCount;
|
||||||
|
@ -265,7 +266,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
boolean skipImplRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES);
|
boolean skipImplRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES);
|
||||||
boolean skipTypeRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES);
|
boolean skipTypeRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_TYPE_REFERENCES);
|
||||||
boolean skipMacroRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_MACRO_REFERENCES);
|
boolean skipMacroRefs= skipRefs || checkProperty(IndexerPreferences.KEY_SKIP_MACRO_REFERENCES);
|
||||||
System.out.println(ident + " Options: " //$NON-NLS-1$
|
System.out.println(indent + " Options: " //$NON-NLS-1$
|
||||||
+ "indexer='" + kind //$NON-NLS-1$
|
+ "indexer='" + kind //$NON-NLS-1$
|
||||||
+ "', parseAllFiles=" + indexFilesWithoutConfiguration() //$NON-NLS-1$
|
+ "', parseAllFiles=" + indexFilesWithoutConfiguration() //$NON-NLS-1$
|
||||||
+ ", unusedHeaders=" + getIndexHeadersWithoutContext() //$NON-NLS-1$
|
+ ", unusedHeaders=" + getIndexHeadersWithoutContext() //$NON-NLS-1$
|
||||||
|
@ -274,25 +275,25 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
+ ", skipTypeReferences=" + skipTypeRefs //$NON-NLS-1$
|
+ ", skipTypeReferences=" + skipTypeRefs //$NON-NLS-1$
|
||||||
+ ", skipMacroReferences=" + skipMacroRefs //$NON-NLS-1$
|
+ ", skipMacroReferences=" + skipMacroRefs //$NON-NLS-1$
|
||||||
+ "."); //$NON-NLS-1$
|
+ "."); //$NON-NLS-1$
|
||||||
System.out.println(ident + " Database: " + dbSize + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
|
System.out.println(indent + " Database: " + dbSize + " bytes"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
System.out.println(ident + " Timings: " //$NON-NLS-1$
|
System.out.println(indent + " Timings: " //$NON-NLS-1$
|
||||||
+ totalTime + " total, " //$NON-NLS-1$
|
+ totalTime + " total, " //$NON-NLS-1$
|
||||||
+ fStatistics.fParsingTime + " parser, " //$NON-NLS-1$
|
+ fStatistics.fParsingTime + " parser, " //$NON-NLS-1$
|
||||||
+ fStatistics.fResolutionTime + " resolution, " //$NON-NLS-1$
|
+ fStatistics.fResolutionTime + " resolution, " //$NON-NLS-1$
|
||||||
+ fStatistics.fAddToIndexTime + " index update."); //$NON-NLS-1$
|
+ fStatistics.fAddToIndexTime + " index update."); //$NON-NLS-1$
|
||||||
System.out.println(ident + " Errors: " //$NON-NLS-1$
|
System.out.println(indent + " Errors: " //$NON-NLS-1$
|
||||||
+ fStatistics.fErrorCount + " internal, " //$NON-NLS-1$
|
+ fStatistics.fErrorCount + " internal, " //$NON-NLS-1$
|
||||||
+ fStatistics.fUnresolvedIncludesCount + " include, " //$NON-NLS-1$
|
+ fStatistics.fUnresolvedIncludesCount + " include, " //$NON-NLS-1$
|
||||||
+ fStatistics.fPreprocessorProblemCount + " scanner, " //$NON-NLS-1$
|
+ fStatistics.fPreprocessorProblemCount + " scanner, " //$NON-NLS-1$
|
||||||
+ fStatistics.fSyntaxProblemsCount + " syntax errors."); //$NON-NLS-1$
|
+ fStatistics.fSyntaxProblemsCount + " syntax errors."); //$NON-NLS-1$
|
||||||
if (fStatistics.fTooManyTokensCount > 0)
|
if (fStatistics.fTooManyTokensCount > 0)
|
||||||
System.out.println(ident + " Tokens: " //$NON-NLS-1$
|
System.out.println(indent + " Tokens: " //$NON-NLS-1$
|
||||||
+ fStatistics.fTooManyTokensCount + " TUs with too many tokens."); //$NON-NLS-1$
|
+ fStatistics.fTooManyTokensCount + " TUs with too many tokens."); //$NON-NLS-1$
|
||||||
|
|
||||||
NumberFormat nfPercent= NumberFormat.getPercentInstance();
|
NumberFormat nfPercent= NumberFormat.getPercentInstance();
|
||||||
nfPercent.setMaximumFractionDigits(2);
|
nfPercent.setMaximumFractionDigits(2);
|
||||||
nfPercent.setMinimumFractionDigits(2);
|
nfPercent.setMinimumFractionDigits(2);
|
||||||
System.out.println(ident + " Names: " //$NON-NLS-1$
|
System.out.println(indent + " Names: " //$NON-NLS-1$
|
||||||
+ fStatistics.fDeclarationCount + " declarations, " //$NON-NLS-1$
|
+ fStatistics.fDeclarationCount + " declarations, " //$NON-NLS-1$
|
||||||
+ fStatistics.fReferenceCount + " references, " //$NON-NLS-1$
|
+ fStatistics.fReferenceCount + " references, " //$NON-NLS-1$
|
||||||
+ fStatistics.fProblemBindingCount + "(" + nfPercent.format(problemPct) + ") unresolved."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ fStatistics.fProblemBindingCount + "(" + nfPercent.format(problemPct) + ") unresolved."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -301,7 +302,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
long hits= index.getCacheHits();
|
long hits= index.getCacheHits();
|
||||||
long tries= misses + hits;
|
long tries= misses + hits;
|
||||||
double missPct= tries == 0 ? 0.0 : (double) misses / (double) tries;
|
double missPct= tries == 0 ? 0.0 : (double) misses / (double) tries;
|
||||||
System.out.println(ident + " Cache[" //$NON-NLS-1$
|
System.out.println(indent + " Cache[" //$NON-NLS-1$
|
||||||
+ ChunkCache.getSharedInstance().getMaxSize() / 1024 / 1024 + "MB]: " + //$NON-NLS-1$
|
+ ChunkCache.getSharedInstance().getMaxSize() / 1024 / 1024 + "MB]: " + //$NON-NLS-1$
|
||||||
+ hits + " hits, " //$NON-NLS-1$
|
+ hits + " hits, " //$NON-NLS-1$
|
||||||
+ misses + "(" + nfPercent.format(missPct) + ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ misses + "(" + nfPercent.format(missPct) + ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.eclipse.osgi.util.NLS;
|
||||||
*/
|
*/
|
||||||
public class PDOMRebuildTask implements IPDOMIndexerTask {
|
public class PDOMRebuildTask implements IPDOMIndexerTask {
|
||||||
protected static final String TRUE= String.valueOf(true);
|
protected static final String TRUE= String.valueOf(true);
|
||||||
protected static final ITranslationUnit[] NO_TUS = new ITranslationUnit[0];
|
protected static final ITranslationUnit[] NO_TUS = {};
|
||||||
|
|
||||||
private final IPDOMIndexer fIndexer;
|
private final IPDOMIndexer fIndexer;
|
||||||
private final IndexerProgress fProgress;
|
private final IndexerProgress fProgress;
|
||||||
|
@ -78,7 +78,7 @@ public class PDOMRebuildTask implements IPDOMIndexerTask {
|
||||||
createDelegate(cproject, monitor);
|
createDelegate(cproject, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove task-tags.
|
// Remove task-tags.
|
||||||
TodoTaskUpdater.removeTasksFor(project);
|
TodoTaskUpdater.removeTasksFor(project);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(NLS.bind(Messages.PDOMRebuildTask_0, cproject.getElementName() ), e);
|
CCorePlugin.log(NLS.bind(Messages.PDOMRebuildTask_0, cproject.getElementName() ), e);
|
||||||
|
@ -112,7 +112,7 @@ public class PDOMRebuildTask implements IPDOMIndexerTask {
|
||||||
boolean allFiles =
|
boolean allFiles =
|
||||||
TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG)) ||
|
TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_DEFAULT_LANG)) ||
|
||||||
TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG));
|
TRUE.equals(fIndexer.getProperty(IndexerPreferences.KEY_INDEX_UNUSED_HEADERS_WITH_ALTERNATE_LANG));
|
||||||
List<ITranslationUnit> sources= new ArrayList<ITranslationUnit>();
|
List<ITranslationUnit> sources= new ArrayList<>();
|
||||||
List<ITranslationUnit> headers= allFiles ? sources : null;
|
List<ITranslationUnit> headers= allFiles ? sources : null;
|
||||||
TranslationUnitCollector collector= new TranslationUnitCollector(sources, headers, monitor);
|
TranslationUnitCollector collector= new TranslationUnitCollector(sources, headers, monitor);
|
||||||
project.accept(collector);
|
project.accept(collector);
|
||||||
|
|
|
@ -75,8 +75,7 @@ public class TodoTaskParser {
|
||||||
return tasks.toArray(new Task[tasks.size()]);
|
return tasks.toArray(new Task[tasks.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parse(char[] comment, String filename, int offset, int lineNumber,
|
private void parse(char[] comment, String filename, int offset, int lineNumber, List<Task> tasks) {
|
||||||
List<Task> tasks) {
|
|
||||||
int commentLength = comment.length;
|
int commentLength = comment.length;
|
||||||
|
|
||||||
int foundTaskIndex = tasks.size();
|
int foundTaskIndex = tasks.size();
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
* Sergey Prigogin (Google) - initial API and implementation
|
* Sergey Prigogin (Google) - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -100,12 +99,14 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
class TaskList {
|
class TaskList {
|
||||||
IFile fFile;
|
IFile fFile;
|
||||||
List<Task> fTasks;
|
List<Task> fTasks;
|
||||||
|
|
||||||
public TaskList(IFile file) {
|
public TaskList(IFile file) {
|
||||||
fFile= file;
|
fFile= file;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(Task task) {
|
public void add(Task task) {
|
||||||
if (fTasks == null) {
|
if (fTasks == null) {
|
||||||
fTasks= new ArrayList<Task>();
|
fTasks= new ArrayList<>();
|
||||||
}
|
}
|
||||||
fTasks.add(task);
|
fTasks.add(task);
|
||||||
}
|
}
|
||||||
|
@ -113,9 +114,9 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
|
|
||||||
final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
|
final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
// first collect all valid file-locations
|
// First collect all valid file-locations.
|
||||||
final Map<IPath, TaskList> pathToTaskList= new HashMap<IPath, TaskList>();
|
final Map<IPath, TaskList> pathToTaskList= new HashMap<>();
|
||||||
final Set<IProject> projects= new HashSet<IProject>();
|
final Set<IProject> projects= new HashSet<>();
|
||||||
for (final IIndexFileLocation indexFileLocation : filesToUpdate) {
|
for (final IIndexFileLocation indexFileLocation : filesToUpdate) {
|
||||||
final String filepath = indexFileLocation.getFullPath();
|
final String filepath = indexFileLocation.getFullPath();
|
||||||
if (filepath != null) {
|
if (filepath != null) {
|
||||||
|
@ -137,7 +138,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// run this in a job in order not to block the indexer (bug 210730).
|
// Update markers in a job in order not to block the indexer (bug 210730).
|
||||||
if (!pathToTaskList.isEmpty()) {
|
if (!pathToTaskList.isEmpty()) {
|
||||||
WorkspaceJob job= new WorkspaceJob(Messages.TodoTaskUpdater_UpdateJob) {
|
WorkspaceJob job= new WorkspaceJob(Messages.TodoTaskUpdater_UpdateJob) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -174,8 +175,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
|
|
||||||
private void applyTask(Task task, IResource resource) throws CoreException {
|
private void applyTask(Task task, IResource resource) throws CoreException {
|
||||||
IMarker marker = resource.createMarker(ICModelMarker.TASK_MARKER);
|
IMarker marker = resource.createMarker(ICModelMarker.TASK_MARKER);
|
||||||
String description = NLS.bind(Messages.TodoTaskUpdater_taskFormat,
|
String description = NLS.bind(Messages.TodoTaskUpdater_taskFormat, task.getTag(), task.getMessage());
|
||||||
task.getTag(), task.getMessage());
|
|
||||||
marker.setAttributes(
|
marker.setAttributes(
|
||||||
TASK_MARKER_ATTRIBUTE_NAMES,
|
TASK_MARKER_ATTRIBUTE_NAMES,
|
||||||
new Object[] {
|
new Object[] {
|
||||||
|
@ -203,7 +203,7 @@ public class TodoTaskUpdater implements ITodoTaskUpdater {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// run this in a job in order not to block the indexer (bug 210730).
|
// Delete markers in a job in order not to block the indexer (bug 210730).
|
||||||
WorkspaceJob job= new WorkspaceJob(Messages.TodoTaskUpdater_DeleteJob) {
|
WorkspaceJob job= new WorkspaceJob(Messages.TodoTaskUpdater_DeleteJob) {
|
||||||
@Override
|
@Override
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
|
|
|
@ -64,7 +64,7 @@ public abstract class IncludesTestBase extends BaseTestCase {
|
||||||
protected TestSourceFile selectedFile;
|
protected TestSourceFile selectedFile;
|
||||||
private StringBuilder[] testData;
|
private StringBuilder[] testData;
|
||||||
private boolean cpp = true;
|
private boolean cpp = true;
|
||||||
private final Set<TestSourceFile> testFiles = new LinkedHashSet<TestSourceFile>();
|
private final Set<TestSourceFile> testFiles = new LinkedHashSet<>();
|
||||||
|
|
||||||
protected IncludesTestBase() {
|
protected IncludesTestBase() {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class HeaderSubstitutor {
|
||||||
IncludeInfo includeInfo = fContext.getIncludeForHeaderFile(path);
|
IncludeInfo includeInfo = fContext.getIncludeForHeaderFile(path);
|
||||||
if (includeInfo == null)
|
if (includeInfo == null)
|
||||||
return path;
|
return path;
|
||||||
List<IncludeInfo> candidates = new ArrayList<IncludeInfo>();
|
List<IncludeInfo> candidates = new ArrayList<>();
|
||||||
candidates.add(includeInfo);
|
candidates.add(includeInfo);
|
||||||
IncludeMap[] maps = fIncludeMaps;
|
IncludeMap[] maps = fIncludeMaps;
|
||||||
for (IncludeMap map : maps) {
|
for (IncludeMap map : maps) {
|
||||||
|
@ -150,8 +150,8 @@ public class HeaderSubstitutor {
|
||||||
public IPath getPreferredRepresentativeHeaderByHeuristic(InclusionRequest request) {
|
public IPath getPreferredRepresentativeHeaderByHeuristic(InclusionRequest request) {
|
||||||
Set<IIndexFile> indexFiles = request.getDeclaringFiles().keySet();
|
Set<IIndexFile> indexFiles = request.getDeclaringFiles().keySet();
|
||||||
String symbolName = request.getBinding().getName();
|
String symbolName = request.getBinding().getName();
|
||||||
ArrayDeque<IIndexFile> front = new ArrayDeque<IIndexFile>();
|
ArrayDeque<IIndexFile> front = new ArrayDeque<>();
|
||||||
HashSet<IIndexFile> processed = new HashSet<IIndexFile>();
|
HashSet<IIndexFile> processed = new HashSet<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Look for headers without an extension and a matching name.
|
// Look for headers without an extension and a matching name.
|
||||||
|
|
|
@ -42,9 +42,9 @@ public class IncludeCreationContext extends InclusionContext {
|
||||||
public IncludeCreationContext(ITranslationUnit tu, IIndex index) {
|
public IncludeCreationContext(ITranslationUnit tu, IIndex index) {
|
||||||
super(tu);
|
super(tu);
|
||||||
fIndex = index;
|
fIndex = index;
|
||||||
fHeadersToInclude = new HashSet<IPath>();
|
fHeadersToInclude = new HashSet<>();
|
||||||
fHeadersAlreadyIncluded = new HashSet<IPath>();
|
fHeadersAlreadyIncluded = new HashSet<>();
|
||||||
fHeadersIncludedPreviously = new HashSet<IPath>();
|
fHeadersIncludedPreviously = new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSourceContents() {
|
public String getSourceContents() {
|
||||||
|
@ -67,7 +67,7 @@ public class IncludeCreationContext extends InclusionContext {
|
||||||
*/
|
*/
|
||||||
public void removeExportedHeaders() throws CoreException {
|
public void removeExportedHeaders() throws CoreException {
|
||||||
// Index files keyed by their absolute paths.
|
// Index files keyed by their absolute paths.
|
||||||
Map<IPath, IIndexFile> filesByPath = new HashMap<IPath, IIndexFile>();
|
Map<IPath, IIndexFile> filesByPath = new HashMap<>();
|
||||||
for (IIndexFile file : fIndex.getAllFiles()) {
|
for (IIndexFile file : fIndex.getAllFiles()) {
|
||||||
IPath path = getPath(file);
|
IPath path = getPath(file);
|
||||||
filesByPath.put(path, file);
|
filesByPath.put(path, file);
|
||||||
|
@ -79,12 +79,12 @@ public class IncludeCreationContext extends InclusionContext {
|
||||||
|
|
||||||
private void removeExportedHeaders(Set<IPath> exportingHeaders,
|
private void removeExportedHeaders(Set<IPath> exportingHeaders,
|
||||||
Map<IPath, IIndexFile> filesByPath) throws CoreException {
|
Map<IPath, IIndexFile> filesByPath) throws CoreException {
|
||||||
Set<IPath> exportedHeaders = new HashSet<IPath>();
|
Set<IPath> exportedHeaders = new HashSet<>();
|
||||||
for (IPath path : exportingHeaders) {
|
for (IPath path : exportingHeaders) {
|
||||||
if (!exportedHeaders.contains(path)) {
|
if (!exportedHeaders.contains(path)) {
|
||||||
IIndexFile file = filesByPath.get(path);
|
IIndexFile file = filesByPath.get(path);
|
||||||
if (file != null) { // file can be null if the header was not indexed.
|
if (file != null) { // file can be null if the header was not indexed.
|
||||||
ArrayDeque<IIndexFile> queue = new ArrayDeque<IIndexFile>();
|
ArrayDeque<IIndexFile> queue = new ArrayDeque<>();
|
||||||
queue.add(file);
|
queue.add(file);
|
||||||
while ((file = queue.pollFirst()) != null) {
|
while ((file = queue.pollFirst()) != null) {
|
||||||
for (IIndexInclude include : file.getIncludes()) {
|
for (IIndexInclude include : file.getIncludes()) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class IncludeMap {
|
||||||
|
|
||||||
public IncludeMap(boolean unconditionalSubstitution) {
|
public IncludeMap(boolean unconditionalSubstitution) {
|
||||||
this.unconditionalSubstitution = unconditionalSubstitution;
|
this.unconditionalSubstitution = unconditionalSubstitution;
|
||||||
this.map = new LinkedHashMap<IncludeInfo, List<IncludeInfo>>();
|
this.map = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +51,7 @@ public class IncludeMap {
|
||||||
if (keysAndValues.length % 2 != 0)
|
if (keysAndValues.length % 2 != 0)
|
||||||
throw new IllegalArgumentException("More keys than values"); //$NON-NLS-1$
|
throw new IllegalArgumentException("More keys than values"); //$NON-NLS-1$
|
||||||
this.unconditionalSubstitution = unconditionalSubstitution;
|
this.unconditionalSubstitution = unconditionalSubstitution;
|
||||||
this.map = new LinkedHashMap<IncludeInfo, List<IncludeInfo>>(keysAndValues.length / 2);
|
this.map = new LinkedHashMap<>(keysAndValues.length / 2);
|
||||||
for (int i = 0; i < keysAndValues.length;) {
|
for (int i = 0; i < keysAndValues.length;) {
|
||||||
String key = keysAndValues[i++];
|
String key = keysAndValues[i++];
|
||||||
addMapping(key, keysAndValues[i++]);
|
addMapping(key, keysAndValues[i++]);
|
||||||
|
@ -60,7 +60,7 @@ public class IncludeMap {
|
||||||
|
|
||||||
public IncludeMap(IncludeMap other) {
|
public IncludeMap(IncludeMap other) {
|
||||||
this.unconditionalSubstitution = other.unconditionalSubstitution;
|
this.unconditionalSubstitution = other.unconditionalSubstitution;
|
||||||
this.map = new LinkedHashMap<IncludeInfo, List<IncludeInfo>>(other.map.size());
|
this.map = new LinkedHashMap<>(other.map.size());
|
||||||
addAllMappings(other);
|
addAllMappings(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class IncludeMap {
|
||||||
return; // Don't allow mapping to itself.
|
return; // Don't allow mapping to itself.
|
||||||
List<IncludeInfo> list = map.get(from);
|
List<IncludeInfo> list = map.get(from);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = new ArrayList<IncludeInfo>(2);
|
list = new ArrayList<>(2);
|
||||||
map.put(from, list);
|
map.put(from, list);
|
||||||
}
|
}
|
||||||
list.add(to);
|
list.add(to);
|
||||||
|
@ -158,7 +158,7 @@ public class IncludeMap {
|
||||||
* Writes the map to a memento. The {@link #isUnconditionalSubstitution()} flag is not written.
|
* Writes the map to a memento. The {@link #isUnconditionalSubstitution()} flag is not written.
|
||||||
*/
|
*/
|
||||||
public void saveToMemento(IMemento memento) {
|
public void saveToMemento(IMemento memento) {
|
||||||
List<IncludeInfo> keys = new ArrayList<IncludeInfo>(map.keySet());
|
List<IncludeInfo> keys = new ArrayList<>(map.keySet());
|
||||||
Collections.sort(keys);
|
Collections.sort(keys);
|
||||||
for (IncludeInfo key : keys) {
|
for (IncludeInfo key : keys) {
|
||||||
for (IncludeInfo value : map.get(key)) {
|
for (IncludeInfo value : map.get(key)) {
|
||||||
|
@ -189,7 +189,7 @@ public class IncludeMap {
|
||||||
List<IncludeInfo> otherTargets = entry.getValue();
|
List<IncludeInfo> otherTargets = entry.getValue();
|
||||||
List<IncludeInfo> targets = map.get(source);
|
List<IncludeInfo> targets = map.get(source);
|
||||||
if (targets == null) {
|
if (targets == null) {
|
||||||
targets = new ArrayList<IncludeInfo>(otherTargets);
|
targets = new ArrayList<>(otherTargets);
|
||||||
map.put(source, targets);
|
map.put(source, targets);
|
||||||
} else {
|
} else {
|
||||||
targets.addAll(otherTargets);
|
targets.addAll(otherTargets);
|
||||||
|
@ -201,12 +201,12 @@ public class IncludeMap {
|
||||||
for (Entry<IncludeInfo, List<IncludeInfo>> entry : map.entrySet()) {
|
for (Entry<IncludeInfo, List<IncludeInfo>> entry : map.entrySet()) {
|
||||||
IncludeInfo source = entry.getKey();
|
IncludeInfo source = entry.getKey();
|
||||||
List<IncludeInfo> targets = entry.getValue();
|
List<IncludeInfo> targets = entry.getValue();
|
||||||
ArrayDeque<IncludeInfo> queue = new ArrayDeque<IncludeInfo>(targets);
|
ArrayDeque<IncludeInfo> queue = new ArrayDeque<>(targets);
|
||||||
targets.clear();
|
targets.clear();
|
||||||
HashSet<IncludeInfo> processed = new HashSet<IncludeInfo>();
|
HashSet<IncludeInfo> processed = new HashSet<>();
|
||||||
if (!unconditionalSubstitution)
|
if (!unconditionalSubstitution)
|
||||||
processed.add(source); // Don't allow mapping to itself.
|
processed.add(source); // Don't allow mapping to itself.
|
||||||
HashSet<IncludeInfo> seenTargets = new HashSet<IncludeInfo>();
|
HashSet<IncludeInfo> seenTargets = new HashSet<>();
|
||||||
IncludeInfo target;
|
IncludeInfo target;
|
||||||
queueLoop: while ((target = queue.pollFirst()) != null) {
|
queueLoop: while ((target = queue.pollFirst()) != null) {
|
||||||
if (processed.contains(target))
|
if (processed.contains(target))
|
||||||
|
@ -263,7 +263,7 @@ public class IncludeMap {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("upconditionalSubstitution = ").append(unconditionalSubstitution); //$NON-NLS-1$
|
buf.append("upconditionalSubstitution = ").append(unconditionalSubstitution); //$NON-NLS-1$
|
||||||
ArrayList<IncludeInfo> sources = new ArrayList<IncludeInfo>(map.keySet());
|
ArrayList<IncludeInfo> sources = new ArrayList<>(map.keySet());
|
||||||
Collections.sort(sources);
|
Collections.sort(sources);
|
||||||
for (IncludeInfo source : sources) {
|
for (IncludeInfo source : sources) {
|
||||||
buf.append('\n');
|
buf.append('\n');
|
||||||
|
|
Loading…
Add table
Reference in a new issue