6396503: javac should not require assertions enabled

Reviewed-by: mcimadamore
This commit is contained in:
Jonathan Gibbons 2011-01-10 15:08:31 -08:00
parent 43e78a8d44
commit e2ed68fb2f
35 changed files with 346 additions and 243 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -172,7 +172,7 @@ public class ToolProvider {
{
// try loading class directly, in case tool is on the bootclasspath
try {
return enableAsserts(Class.forName(toolClassName, false, null));
return Class.forName(toolClassName, false, null);
} catch (ClassNotFoundException e) {
trace(FINE, e);
@ -194,27 +194,10 @@ public class ToolProvider {
trace(FINE, urls[0].toString());
cl = URLClassLoader.newInstance(urls);
cl.setPackageAssertionStatus("com.sun.tools.javac", true);
refToolClassLoader = new WeakReference<ClassLoader>(cl);
}
return Class.forName(toolClassName, false, cl);
}
}
private static Class<?> enableAsserts(Class<?> cls) {
try {
ClassLoader loader = cls.getClassLoader();
if (loader != null)
loader.setPackageAssertionStatus("com.sun.tools.javac", true);
else
trace(FINE, "loader == null");
} catch (SecurityException ex) {
trace(FINE, ex);
}
return cls;
}
}