Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"Bash(python3 -m json.tool)",
"Bash(timeout 300 ./gradlew:*)",
"Bash(wc:*)",
"Bash(xargs cat:*)",
"Edit(./**)",
"Read(//home/mernst/research/types/checker-framework-fork*/**)",
"Read(//scratch/**)",
Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ tasks.register("installGitHooks", Copy) {
description = "Copies git hooks to .git directory"
from("githooks")
into(".git/hooks")
eachFile {
File target = file("$destinationDir/$relativePath")
if (java.nio.file.Files.isSymbolicLink(target.toPath())) {
java.nio.file.Files.delete(target.toPath()) // Fail if the symlink cannot be removed
}
}
Comment thread
mernst marked this conversation as resolved.
}

tasks.withType(JavaCompile) {
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/plumelib/bcelutil/BcelUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,14 @@ public static String methodDeclarationToString(Method m) {

StringBuilder sb = new StringBuilder();
String flags = accessFlagsToString(m);
boolean argsExist = false;
if (flags != null && !flags.isEmpty()) {
sb.append(String.format("%s ", flags));
}
sb.append(String.format("%s %s(", m.getReturnType(), m.getName()));
for (Type at : m.getArgumentTypes()) {
sb.append(String.format("%s, ", at));
argsExist = true;
}
if (argsExist) {
if (m.getArgumentTypes().length > 0) {
sb.setLength(sb.length() - 2); // remove trailing ", "
}
sb.append(')');
Expand Down Expand Up @@ -277,7 +275,7 @@ public static boolean inJdkInternalform(@InternalForm String classname) {
|| classname.startsWith("com/sun/")
|| classname.startsWith("javax/")
|| classname.startsWith("jdk/")
|| classname.startsWith("org/ietj/")
|| classname.startsWith("org/ietf/")
|| classname.startsWith("org/jcp/")
|| classname.startsWith("org/w3c/")
|| classname.startsWith("org/xml/")
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/plumelib/bcelutil/StackMapUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public StackMapUtils() {

/** An empty StackMap used for initialization. */
@SuppressWarnings("interning") // @InternedDistinct initalization with fresh object
private StackMapEntry @InternedDistinct [] emptyStackmaptable = {};
private StackMapEntry @InternedDistinct [] emptyStackMapTable = {};

/**
* A map from instructions that create uninitialized NEW objects to the corresponding StackMap
Expand Down Expand Up @@ -551,7 +551,7 @@ protected final void setCurrentStackMapTable(MethodGen mgen, int javaClassVersio
// Delete existing stack map - we'll add a new one later.
mgen.removeCodeAttribute(smta);
} else {
stackMapTable = emptyStackmaptable;
stackMapTable = emptyStackMapTable;
if (javaClassVersion > Const.MAJOR_1_6) {
needStackMap = true;
}
Expand Down Expand Up @@ -585,7 +585,7 @@ protected final void createNewStackMapAttribute(MethodGen mgen) throws IOExcepti
if (!needStackMap) {
return;
}
if (stackMapTable == emptyStackmaptable) {
if (stackMapTable == emptyStackMapTable) {
return;
}
printStackMapTable("Final");
Expand Down
43 changes: 15 additions & 28 deletions src/main/java/org/plumelib/bcelutil/StackTypes.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.plumelib.bcelutil;

import java.util.StringJoiner;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.MethodGen;
import org.apache.bcel.generic.Type;
Expand Down Expand Up @@ -72,17 +73,14 @@ public OperandStack get(@IndexFor({"localVariableses", "operandStacks"}) int off
@SideEffectFree
@Override
public String toString(@GuardSatisfied StackTypes this) {

StringBuilder sb = new StringBuilder();

for (int i = 0; i < operandStacks.length; i++) {
if (operandStacks[i] != null) {
sb.append(String.format("Instruction %d:\n", i));
sb.append(String.format(" stack: %s\n", toString(operandStacks[i])));
sb.append(String.format(" locals: %s\n", toString(localVariableses[i])));
}
}

return sb.toString();
}

Expand All @@ -92,24 +90,18 @@ public String toString(@GuardSatisfied StackTypes this) {
* @param os the OperandStack to print
* @return a printed representation of {@code os}
*/
@SuppressWarnings({
"allcheckers:purity.not.sideeffectfree.call",
"lock:method.guarantee.violated"
}) // side effect to local state
@SideEffectFree
public String toString(@GuardSatisfied StackTypes this, OperandStack os) {

String buff = "";

StringJoiner sj = new StringJoiner(", ", "{", "}");
for (int i = 0; i < os.size(); i++) {
if (buff.length() > 0) {
buff += ", ";
}
Type t = os.peek(i);
if (t instanceof UninitializedObjectType) {
buff += "uninitialized-object";
} else {
buff += t;
}
sj.add(t instanceof UninitializedObjectType ? "uninitialized-object" : t.toString());
}

return "{" + buff + "}";
return sj.toString();
}

/**
Expand All @@ -118,22 +110,17 @@ public String toString(@GuardSatisfied StackTypes this, OperandStack os) {
* @param lv the LocalVariablesStack to print
* @return a printed representation of {@code lv}
*/
@SuppressWarnings({
"allcheckers:purity.not.sideeffectfree.call",
"lock:method.guarantee.violated"
}) // side effect to local state
@SideEffectFree
public String toString(@GuardSatisfied StackTypes this, LocalVariables lv) {

String buff = "";

StringJoiner sj = new StringJoiner(", ", "{", "}");
for (int i = 0; i < lv.maxLocals(); i++) {
if (buff.length() > 0) {
buff += ", ";
}
Type t = lv.get(i);
if (t instanceof UninitializedObjectType) {
buff += "uninitialized-object";
} else {
buff += t;
}
sj.add(t instanceof UninitializedObjectType ? "uninitialized-object" : t.toString());
}
return "{" + buff + "}";
return sj.toString();
}
}