Skip to content

Commit

Permalink
Update to Google Java Format 1.24.0 (#1433)
Browse files Browse the repository at this point in the history
There are some minor formatting changes with switch statements. Also
remove the old GJF plugin from `libs.version.toml` as we now use
Spotless.
  • Loading branch information
msridhar authored Oct 4, 2024
1 parent 999faf5 commit 904a3a4
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public MiscellaneousHacksContextSelector(
for (String[] descr : descriptors) {
switch (descr.length) {

// loader name, loader language, classname, method name, method descr
// loader name, loader language, classname, method name, method descr
case 5:
{
ClassLoaderReference clr =
Expand All @@ -67,7 +67,7 @@ public MiscellaneousHacksContextSelector(
break;
}

// classname, method name, method descr
// classname, method name, method descr
case 3:
{
MethodReference ref =
Expand All @@ -81,7 +81,7 @@ public MiscellaneousHacksContextSelector(
break;
}

// loader name, classname, meaning all methods of that class
// loader name, classname, meaning all methods of that class
case 2:
{
IClass klass =
Expand All @@ -100,7 +100,7 @@ public MiscellaneousHacksContextSelector(
break;
}

// classname, meaning all methods of that class
// classname, meaning all methods of that class
case 1:
{
IClass klass =
Expand Down
10 changes: 5 additions & 5 deletions cast/src/main/java/com/ibm/wala/cast/util/CAstPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static String kindAsString(int kind) {

public String getKindAsString(int kind) {
switch (kind) {
// statements
// statements
case CAstNode.SWITCH:
return "SWITCH";
case CAstNode.LOOP:
Expand Down Expand Up @@ -107,7 +107,7 @@ public String getKindAsString(int kind) {
case CAstNode.FORIN_LOOP:
return "FOR..IN";

// expression kinds
// expression kinds
case CAstNode.FUNCTION_EXPR:
return "FUNCTION_EXPR";
case CAstNode.EXPR_LIST:
Expand Down Expand Up @@ -169,19 +169,19 @@ public String getKindAsString(int kind) {
case CAstNode.NARY_EXPR:
return "NARY_EXPR";

// explicit lexical scopes
// explicit lexical scopes
case CAstNode.LOCAL_SCOPE:
return "SCOPE";
case CAstNode.SPECIAL_PARENT_SCOPE:
return "SPECIAL PARENT SCOPE";

// literal expression kinds
// literal expression kinds
case CAstNode.CONSTANT:
return "CONSTANT";
case CAstNode.OPERATOR:
return "OPERATOR";

// special stuff
// special stuff
case CAstNode.PRIMITIVE:
return "PRIMITIVE";
case CAstNode.VOID:
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/com/ibm/wala/classLoader/JavaLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -701,11 +701,11 @@ public Collection<TypeReference> getImplicitExceptionTypes(IInstruction pei) {
case OP_invokeinterface:
case OP_monitorenter:
case OP_monitorexit:
// we're currently ignoring MonitorStateExceptions, since J2EE stuff
// should be
// logically single-threaded
// we're currently ignoring MonitorStateExceptions, since J2EE stuff
// should be
// logically single-threaded
case OP_athrow:
// N.B: the caller must handle the explicitly-thrown exception
// N.B: the caller must handle the explicitly-thrown exception
case OP_arraylength:
return getNullPointerException();
case OP_idiv:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ OrdinalSet<Statement> computeResult(
}
}
case HEAP_PARAM_CALLEE:
// no statements in this method will def the heap being passed in
// no statements in this method will def the heap being passed in
case NORMAL_RET_CALLEE:
case NORMAL_RET_CALLER:
case PARAM_CALLEE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public IUnaryFlowFunction getCallNoneToReturnFlowFunction(Statement src, Stateme
case NORMAL_RET_CALLER:
case PARAM_CALLER:
case EXC_RET_CALLER:
// uh oh. anything that flows into the missing function will be killed.
// uh oh. anything that flows into the missing function will be killed.
case NORMAL:
// only control dependence flows into the missing function.
// this control dependence does not flow back to the caller.
Expand Down
60 changes: 30 additions & 30 deletions dalvik/src/main/java/com/ibm/wala/dalvik/classLoader/DexCFG.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,25 +410,25 @@ public Collection<TypeReference> getImplicitExceptionTypes(Instruction pei) {
throw new IllegalArgumentException("pei is null");
}
switch (pei.getOpcode()) {
// TODO: Make sure all the important cases and exceptions are covered.
// TODO: Make sure all the important cases and exceptions are covered.
case AGET:
case AGET_WIDE:
case AGET_OBJECT:
case AGET_BOOLEAN:
case AGET_BYTE:
case AGET_CHAR:
case AGET_SHORT:
// case OP_iaload:
// case OP_laload:
// case OP_faload:
// case OP_daload:
// case OP_aaload:
// case OP_baload:
// case OP_caload:
// case OP_saload:
// case OP_iaload:
// case OP_laload:
// case OP_faload:
// case OP_daload:
// case OP_aaload:
// case OP_baload:
// case OP_caload:
// case OP_saload:
case APUT:
case APUT_WIDE:
// case APUT_OBJECT:
// case APUT_OBJECT:
case APUT_BOOLEAN:
case APUT_BYTE:
case APUT_CHAR:
Expand All @@ -451,39 +451,39 @@ public Collection<TypeReference> getImplicitExceptionTypes(Instruction pei) {
case IGET_BYTE:
case IGET_CHAR:
case IGET_SHORT:
// case OP_getfield:
// case OP_getfield:
case IPUT:
case IPUT_WIDE:
case IPUT_OBJECT:
case IPUT_BOOLEAN:
case IPUT_BYTE:
case IPUT_CHAR:
case IPUT_SHORT:
// case OP_putfield:
// case OP_putfield:

// Shrike imp does not include the static invoke calls, so likewise will do the same
// Shrike imp does not include the static invoke calls, so likewise will do the same
case INVOKE_VIRTUAL:
case INVOKE_SUPER:
case INVOKE_DIRECT:
// case INVOKE_STATIC:
// case INVOKE_STATIC:
case INVOKE_INTERFACE:
case INVOKE_VIRTUAL_RANGE:
case INVOKE_SUPER_RANGE:
case INVOKE_DIRECT_RANGE:
// case INVOKE_STATIC_RANGE:
// case INVOKE_STATIC_RANGE:
case INVOKE_INTERFACE_RANGE:
// case OP_invokevirtual:
// case OP_invokespecial:
// case OP_invokeinterface:
// case OP_invokevirtual:
// case OP_invokespecial:
// case OP_invokeinterface:
case ARRAY_LENGTH:
// case OP_arraylength:
// case OP_arraylength:
case MONITOR_ENTER:
case MONITOR_EXIT:
// case OP_monitorenter:
// case OP_monitorexit:
// we're currently ignoring MonitorStateExceptions, since J2EE stuff
// should be
// logically single-threaded
// case OP_monitorenter:
// case OP_monitorexit:
// we're currently ignoring MonitorStateExceptions, since J2EE stuff
// should be
// logically single-threaded
case THROW:
// case OP_athrow:
// N.B: the caller must handle the explicitly-thrown exception
Expand Down Expand Up @@ -519,12 +519,12 @@ public Collection<TypeReference> getImplicitExceptionTypes(Instruction pei) {
// case OP_checkcast:
return JavaLanguage.getClassCastException();

// I Don't think dalvik has to worry about this?
// case OP_ldc_w:
// if (((ConstantInstruction) pei).getType().equals(TYPE_Class))
// return JavaLanguage.getClassNotFoundException();
// else
// return null;
// I Don't think dalvik has to worry about this?
// case OP_ldc_w:
// if (((ConstantInstruction) pei).getType().equals(TYPE_Class))
// return JavaLanguage.getClassNotFoundException();
// else
// return null;

case SGET:
case SGET_BOOLEAN:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ public void visit(Visitor visitor) {
this));
break;
}
// TODO: FILLED ARRAYS
// TODO: FILLED ARRAYS
case FILLED_NEW_ARRAY:
{
int registerCount = ((Instruction35c) inst).getRegisterCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public boolean isMove() {

public IOperator getOperator() {
switch (op) {
// SSA unary ops
// SSA unary ops
case NOT:
case NOTLONG:
case NOTINT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ public IR getIR(CGNode node) {

break;
case STANDARD_ACTION:
// TODO!
// In Order to correctly evaluate a standard-action we would also have to look
// at the URI of the Intent.
// TODO!
// In Order to correctly evaluate a standard-action we would also have to look
// at the URI of the Intent.
case UNKNOWN_TARGET:
info = intentStarters.getInfo(method.getReference());

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
eclipse = "4.30.0"
eclipse-wst-jsdt = "1.0.201.v2010012803"
google-java-format = "1.17.0"
google-java-format = "1.24.0"
ktfmt = "0.44"
spotless = "6.25.0"

Expand Down
10 changes: 5 additions & 5 deletions shrike/src/main/java/com/ibm/wala/shrike/shrikeBT/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ public void visitSwap(SwapInstruction instruction) {
if (!fallToConditional) {
break;
}
// $FALL-THROUGH$
// $FALL-THROUGH$
case OP_aconst_null:
if (!fallToConditional
&& inBasicBlock(i, 2)
Expand All @@ -620,8 +620,8 @@ && inBasicBlock(i, 2)
if (!fallToConditional) {
break;
}
// by Xiangyu
// $FALL-THROUGH$
// by Xiangyu
// $FALL-THROUGH$
case OP_ifeq:
case OP_ifge:
case OP_ifgt:
Expand Down Expand Up @@ -675,7 +675,7 @@ && inBasicBlock(i, 2)
}
break;
}
// by Xiangyu
// by Xiangyu

case OP_if_icmpeq:
case OP_if_icmpge:
Expand Down Expand Up @@ -866,7 +866,7 @@ && inBasicBlock(i, 2)
break;
}
}
// $FALL-THROUGH$
// $FALL-THROUGH$
case OP_lload:
case OP_fload:
case OP_dload:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,15 @@ private Pair<TypeAnnotationTarget, Integer> getTypeAnnotationTargetAndSize(
return Pair.<TypeAnnotationTarget, Integer>make(
new ThrowsTarget(exceptionReader.getClasses()[throwsIndex]), 2);
}
/*
* localvar_target {
* u2 table_length;
* { u2 start_pc;
u2 length;
u2 index;
* } table[table_length];
* }
*/
/*
* localvar_target {
* u2 table_length;
* { u2 start_pc;
u2 length;
u2 index;
* } table[table_length];
* }
*/
case localvar_target:
{
checkSize(begin, 2);
Expand Down
2 changes: 1 addition & 1 deletion util/src/main/java/com/ibm/wala/util/io/RtJar.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static JarFile getRtJar(Iterator<JarFile> x) {
return JF;
case "classes.jar":
if (PlatformUtil.onMacOSX()) return JF;
// $FALL-THROUGH$
// $FALL-THROUGH$
default:
}
}
Expand Down

0 comments on commit 904a3a4

Please sign in to comment.