Fix NPE that is sometimes thrown when generating debug information.

Enable debug information for html4j TCK
This commit is contained in:
konsoletyper 2014-09-11 10:49:22 +04:00
parent 64847c3888
commit b0b9287659
4 changed files with 7 additions and 4 deletions

View File

@ -72,7 +72,6 @@
<phase>process-test-classes</phase> <phase>process-test-classes</phase>
<configuration> <configuration>
<minifying>false</minifying> <minifying>false</minifying>
<incremental>true</incremental>
<numThreads>1</numThreads> <numThreads>1</numThreads>
<properties> <properties>
<java.util.Locale.available>en, en_US, en_GB, ru, ru_RU</java.util.Locale.available> <java.util.Locale.available>en, en_US, en_GB, ru, ru_RU</java.util.Locale.available>

View File

@ -79,7 +79,9 @@ class LocationGraphBuilder {
} }
} }
if (graph.outgoingEdgesCount(step.block) == 0) { if (graph.outgoingEdgesCount(step.block) == 0) {
addEdge(location, new InstructionLocation(null, -1)); if (location != null) {
addEdge(location, new InstructionLocation(null, -1));
}
} else { } else {
for (int next : graph.outgoingEdges(step.block)) { for (int next : graph.outgoingEdges(step.block)) {
stack.push(new Step(location, started ? new HashSet<InstructionLocation>() : step.startLocations, stack.push(new Step(location, started ? new HashSet<InstructionLocation>() : step.startLocations,

View File

@ -368,7 +368,6 @@ public class TeaVMTestTool {
try (OutputStream debugInfoOut = new FileOutputStream(new File(outputDir, targetName + ".teavmdbg"))) { try (OutputStream debugInfoOut = new FileOutputStream(new File(outputDir, targetName + ".teavmdbg"))) {
debugInfo.write(debugInfoOut); debugInfo.write(debugInfoOut);
} }
log.info("Debug information successfully written");
} }
if (sourceMapsGenerated) { if (sourceMapsGenerated) {
DebugInformation debugInfo = debugInfoBuilder.getDebugInformation(); DebugInformation debugInfo = debugInfoBuilder.getDebugInformation();
@ -377,7 +376,6 @@ public class TeaVMTestTool {
new File(outputDir, sourceMapsFileName)), "UTF-8")) { new File(outputDir, sourceMapsFileName)), "UTF-8")) {
debugInfo.writeAsSourceMaps(sourceMapsOut, targetName); debugInfo.writeAsSourceMaps(sourceMapsOut, targetName);
} }
log.info("Source maps successfully written");
} }
} }

View File

@ -81,6 +81,8 @@
<minifying>false</minifying> <minifying>false</minifying>
<numThreads>1</numThreads> <numThreads>1</numThreads>
<outputDir>${project.build.directory}/javascript-test</outputDir> <outputDir>${project.build.directory}/javascript-test</outputDir>
<debugInformationGenerated>true</debugInformationGenerated>
<sourceMapsGenerated>true</sourceMapsGenerated>
</configuration> </configuration>
</execution> </execution>
<execution> <execution>
@ -98,6 +100,8 @@
<transformers> <transformers>
<param>org.teavm.javascript.NullPointerExceptionTransformer</param> <param>org.teavm.javascript.NullPointerExceptionTransformer</param>
</transformers> </transformers>
<debugInformationGenerated>true</debugInformationGenerated>
<sourceMapsGenerated>true</sourceMapsGenerated>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>