From d485b9b34b10e3f8ce4e7fcff698546391360fd9 Mon Sep 17 00:00:00 2001 From: Cody <6558800+Bl3nd@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:25:12 -0600 Subject: [PATCH 1/2] Remove error strip markers if you click on an empty line. --- .../club/bytecodeviewer/gui/util/BytecodeViewPanelUpdater.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/BytecodeViewPanelUpdater.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/BytecodeViewPanelUpdater.java index b3e8b747..3e39cd93 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/BytecodeViewPanelUpdater.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/BytecodeViewPanelUpdater.java @@ -513,6 +513,7 @@ public class BytecodeViewPanelUpdater implements Runnable if (token == null) { highlighterEx.clearMarkOccurrencesHighlights(); + errorStripe.refreshMarkers(); return; } } From f560fa5b263defb8931b00c6a66108177dea9130 Mon Sep 17 00:00:00 2001 From: Cody <6558800+Bl3nd@users.noreply.github.com> Date: Mon, 7 Oct 2024 17:27:35 -0600 Subject: [PATCH 2/2] Update a few try-catch's to catch all exceptions. --- .../classcontainer/ClassFileContainer.java | 2 +- .../parser/visitors/MyVoidVisitor.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/ClassFileContainer.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/ClassFileContainer.java index 34c47003..5e9f2db5 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/ClassFileContainer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/ClassFileContainer.java @@ -56,7 +56,7 @@ public class ClassFileContainer { if (shouldParse()) { - TypeSolver typeSolver = new CombinedTypeSolver(new ReflectionTypeSolver(false), new JarTypeSolver(path)); + TypeSolver typeSolver = new CombinedTypeSolver(new ReflectionTypeSolver(true), new JarTypeSolver(path)); JavaParser parser = new JavaParser(); parser.getParserConfiguration().setSymbolResolver(new JavaSymbolSolver(typeSolver)); ParseResult parse = parser.parse(this.content); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/parser/visitors/MyVoidVisitor.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/parser/visitors/MyVoidVisitor.java index 1bb6f44a..de7f2dbc 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/parser/visitors/MyVoidVisitor.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/classcontainer/parser/visitors/MyVoidVisitor.java @@ -347,7 +347,7 @@ public class MyVoidVisitor extends VoidVisitorAdapter new ClassReferenceLocation(getOwner(classFileContainer), packagePath, "", "reference", classValue.line, classValue.columnStart, classValue.columnEnd + 1)); } - catch (ClassCastException | UnsupportedOperationException | IllegalArgumentException e) + catch (Exception e) { printException(n, e); } @@ -401,7 +401,7 @@ public class MyVoidVisitor extends VoidVisitorAdapter if (node instanceof ObjectCreationExpr) { NodeList> bodyDeclarations = - ((ObjectCreationExpr) node).getAnonymousClassBody().orElse(null); + ((ObjectCreationExpr) node).getAnonymousClassBody().orElse(null); if (bodyDeclarations != null) { if (Objects.requireNonNull(bodyDeclarations.getFirst().orElse(null)).equals(n)) @@ -421,10 +421,10 @@ public class MyVoidVisitor extends VoidVisitorAdapter Value constructor = new Value(n.getName(), range); this.classFileContainer.putMethod(constructor.name, new ClassMethodLocation(resolve.getClassName(), - signature, parameters, "declaration", constructor.line, constructor.columnStart, - constructor.columnEnd + 1)); + signature, parameters, "declaration", constructor.line, constructor.columnStart, + constructor.columnEnd + 1)); } - catch (RuntimeException e) + catch (Exception e) { printException(n, e); } @@ -566,7 +566,7 @@ public class MyVoidVisitor extends VoidVisitorAdapter Value field = new Value(variableDeclarator.getName(), range); this.classFileContainer.putField(field.name, new ClassFieldLocation(getOwner(classFileContainer), - "declaration", field.line, field.columnStart, field.columnEnd + 1)); + "declaration", field.line, field.columnStart, field.columnEnd + 1)); }); } @@ -828,8 +828,8 @@ public class MyVoidVisitor extends VoidVisitorAdapter Value methodCall = new Value(n.getName(), methodRange); this.classFileContainer.putMethod(methodCall.name, - new ClassMethodLocation(resolve.getClassName(), signature, parameters, "reference", methodCall.line, - methodCall.columnStart, methodCall.columnEnd + 1)); + new ClassMethodLocation(resolve.getClassName(), signature, parameters, "reference", methodCall.line, + methodCall.columnStart, methodCall.columnEnd + 1)); if (method != null) { @@ -875,7 +875,7 @@ public class MyVoidVisitor extends VoidVisitorAdapter Value method = new Value(n.getName(), methodRange); this.classFileContainer.putMethod(method.name, new ClassMethodLocation(resolve.getClassName(), signature, - parameters, "declaration", method.line, method.columnStart, method.columnEnd + 1)); + parameters, "declaration", method.line, method.columnStart, method.columnEnd + 1)); } catch (Exception e) {