Lines 46-51
Link Here
|
46 |
|
46 |
|
47 |
import java.io.File; |
47 |
import java.io.File; |
48 |
import java.io.IOException; |
48 |
import java.io.IOException; |
|
|
49 |
import java.lang.reflect.InvocationTargetException; |
50 |
import java.lang.reflect.Method; |
49 |
import java.net.MalformedURLException; |
51 |
import java.net.MalformedURLException; |
50 |
import java.util.Arrays; |
52 |
import java.util.Arrays; |
51 |
import java.util.Iterator; |
53 |
import java.util.Iterator; |
Lines 62-71
Link Here
|
62 |
*/ |
64 |
*/ |
63 |
public class JavacTask extends Javac { |
65 |
public class JavacTask extends Javac { |
64 |
|
66 |
|
|
|
67 |
private static final String CLASS_ZIP_FILE_INDEX = "com.sun.tools.javac.zip.ZipFileIndex"; //NOI18N |
68 |
private static final String METHOD_CLOSE = "clearCache"; //NOI18N |
69 |
|
65 |
@Override |
70 |
@Override |
66 |
public void execute() throws BuildException { |
71 |
public void execute() throws BuildException { |
67 |
Project p = getProject(); |
72 |
final Project p = getProject(); |
68 |
|
|
|
69 |
p.log("Overridden Javac task called", Project.MSG_DEBUG); |
73 |
p.log("Overridden Javac task called", Project.MSG_DEBUG); |
70 |
|
74 |
|
71 |
boolean ensureBuilt = p.getProperty("ensure.built.source.roots") != null |
75 |
boolean ensureBuilt = p.getProperty("ensure.built.source.roots") != null |
Lines 105-111
Link Here
|
105 |
} |
109 |
} |
106 |
|
110 |
|
107 |
if (!wasBuilt) { |
111 |
if (!wasBuilt) { |
108 |
super.execute(); |
112 |
try { |
|
|
113 |
super.execute(); |
114 |
} finally { |
115 |
cleanUp(p); |
116 |
} |
109 |
} |
117 |
} |
110 |
} else { |
118 |
} else { |
111 |
if (CheckForCleanBuilds.cleanBuild.get() && getSrcdir() != null) { |
119 |
if (CheckForCleanBuilds.cleanBuild.get() && getSrcdir() != null) { |
Lines 132-139
Link Here
|
132 |
} |
140 |
} |
133 |
} |
141 |
} |
134 |
} |
142 |
} |
|
|
143 |
try { |
144 |
super.execute(); |
145 |
} finally { |
146 |
cleanUp(p); |
147 |
} |
148 |
} |
149 |
} |
135 |
|
150 |
|
136 |
super.execute(); |
151 |
|
|
|
152 |
private static void cleanUp (final Project p) { |
153 |
try { |
154 |
p.log("Cleaning ZipFileIndex cache", Project.MSG_DEBUG); //NOI18N |
155 |
final Class<?> zipFileIndex = Class.forName(CLASS_ZIP_FILE_INDEX); |
156 |
final Method clean = zipFileIndex.getDeclaredMethod(METHOD_CLOSE); |
157 |
clean.invoke(null); |
158 |
p.log("ZipFileIndex cache cleaned", Project.MSG_DEBUG); //NOI18N |
159 |
} catch (ClassNotFoundException e) { |
160 |
p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE); //NOI18N |
161 |
} catch (NoSuchMethodException e) { |
162 |
p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE); //NOI18N |
163 |
} catch (SecurityException e) { |
164 |
p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE); //NOI18N |
165 |
} catch (InvocationTargetException e) { |
166 |
p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE); //NOI18N |
167 |
} catch (IllegalArgumentException e) { |
168 |
p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE); //NOI18N |
169 |
} catch (IllegalAccessException e) { |
170 |
p.log("ZipFileIndex clearCache failed", e, Project.MSG_VERBOSE); //NOI18N |
137 |
} |
171 |
} |
138 |
} |
172 |
} |
139 |
|
173 |
|