Fix diagnostics no printed from teavm-cli. Fix diagnostics of unavailable classes and methods

This commit is contained in:
Alexey Andreev 2018-12-09 19:54:04 +03:00
parent d74bcbe2b9
commit 952ed3f193
4 changed files with 32 additions and 110 deletions

View File

@ -436,6 +436,7 @@ public abstract class DependencyAnalyzer implements DependencyInfo {
MethodDependency dep = getMethodDependency(className, descriptor); MethodDependency dep = getMethodDependency(className, descriptor);
if (!dep.activated) { if (!dep.activated) {
reachedMethods.add(dep.getReference());
dep.activated = true; dep.activated = true;
if (!dep.isMissing()) { if (!dep.isMissing()) {
for (DependencyListener listener : listeners) { for (DependencyListener listener : listeners) {

View File

@ -194,11 +194,7 @@ public class MissingItemsProcessor {
return true; return true;
} }
private InstructionVisitor instructionProcessor = new InstructionVisitor() { private InstructionVisitor instructionProcessor = new AbstractInstructionVisitor() {
@Override
public void visit(NullCheckInstruction insn) {
}
@Override @Override
public void visit(InitClassInstruction insn) { public void visit(InitClassInstruction insn) {
checkClass(insn.getLocation(), insn.getClassName()); checkClass(insn.getLocation(), insn.getClassName());
@ -218,30 +214,6 @@ public class MissingItemsProcessor {
} }
} }
@Override
public void visit(InvokeDynamicInstruction insn) {
}
@Override
public void visit(PutElementInstruction insn) {
}
@Override
public void visit(GetElementInstruction insn) {
}
@Override
public void visit(UnwrapArrayInstruction insn) {
}
@Override
public void visit(CloneArrayInstruction insn) {
}
@Override
public void visit(ArrayLengthInstruction insn) {
}
@Override @Override
public void visit(PutFieldInstruction insn) { public void visit(PutFieldInstruction insn) {
checkField(insn.getLocation(), insn.getField()); checkField(insn.getLocation(), insn.getField());
@ -267,94 +239,13 @@ public class MissingItemsProcessor {
checkClass(insn.getLocation(), insn.getItemType()); checkClass(insn.getLocation(), insn.getItemType());
} }
@Override
public void visit(RaiseInstruction insn) {
}
@Override
public void visit(ExitInstruction insn) {
}
@Override
public void visit(SwitchInstruction insn) {
}
@Override
public void visit(JumpInstruction insn) {
}
@Override
public void visit(BinaryBranchingInstruction insn) {
}
@Override
public void visit(BranchingInstruction insn) {
}
@Override
public void visit(CastIntegerInstruction insn) {
}
@Override
public void visit(CastNumberInstruction insn) {
}
@Override @Override
public void visit(CastInstruction insn) { public void visit(CastInstruction insn) {
checkClass(insn.getLocation(), insn.getTargetType()); checkClass(insn.getLocation(), insn.getTargetType());
} }
@Override
public void visit(AssignInstruction insn) {
}
@Override
public void visit(NegateInstruction insn) {
}
@Override
public void visit(BinaryInstruction insn) {
}
@Override
public void visit(StringConstantInstruction insn) {
}
@Override
public void visit(DoubleConstantInstruction insn) {
}
@Override
public void visit(FloatConstantInstruction insn) {
}
@Override
public void visit(LongConstantInstruction insn) {
}
@Override
public void visit(IntegerConstantInstruction insn) {
}
@Override
public void visit(NullConstantInstruction insn) {
}
@Override @Override
public void visit(ClassConstantInstruction insn) { public void visit(ClassConstantInstruction insn) {
checkClass(insn.getLocation(), insn.getConstant()); checkClass(insn.getLocation(), insn.getConstant());
} }
@Override
public void visit(EmptyInstruction insn) {
}
@Override
public void visit(MonitorEnterInstruction insn) {
}
@Override
public void visit(MonitorExitInstruction insn) {
}
}; };
} }

View File

@ -57,6 +57,33 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-util</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.carrotsearch</groupId>
<artifactId>hppc</artifactId>
<version>0.7.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<optional>true</optional>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -46,6 +46,7 @@ import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser; import org.apache.commons.cli.PosixParser;
import org.teavm.backend.wasm.render.WasmBinaryVersion; import org.teavm.backend.wasm.render.WasmBinaryVersion;
import org.teavm.tooling.TeaVMProblemRenderer;
import org.teavm.tooling.TeaVMTargetType; import org.teavm.tooling.TeaVMTargetType;
import org.teavm.tooling.TeaVMTool; import org.teavm.tooling.TeaVMTool;
import org.teavm.tooling.TeaVMToolException; import org.teavm.tooling.TeaVMToolException;
@ -535,6 +536,8 @@ public final class TeaVMRunner {
phaseStartTime = System.currentTimeMillis(); phaseStartTime = System.currentTimeMillis();
tool.generate(); tool.generate();
reportPhaseComplete(); reportPhaseComplete();
TeaVMProblemRenderer.describeProblems(tool.getDependencyInfo().getCallGraph(), tool.getProblemProvider(), log);
log.flush();
System.out.println("Build complete for " + ((System.currentTimeMillis() - startTime) / 1000.0) + " seconds"); System.out.println("Build complete for " + ((System.currentTimeMillis() - startTime) / 1000.0) + " seconds");
} }