Skip to content

Commit 866cb77

Browse files
committed
Reformat code
1 parent 608f91f commit 866cb77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2354
-2046
lines changed

app/src/main/java/bsh/BSHAllocationExpression.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import java.lang.reflect.Array;
44
import java.lang.reflect.InvocationTargetException;
55

6-
/** New object, new array, or inner class style allocation with body. */
6+
/**
7+
* New object, new array, or inner class style allocation with body.
8+
*/
79
class BSHAllocationExpression extends SimpleNode {
10+
private static int innerClassCount = 0;
11+
812
BSHAllocationExpression(int id) {
913
super(id);
1014
}
1115

12-
private static int innerClassCount = 0;
13-
1416
public Object eval(CallStack callstack, Interpreter interpreter) throws EvalError {
1517
// type is either a class name or a primitive type
1618
SimpleNode type = (SimpleNode) jjtGetChild(0);
@@ -208,7 +210,7 @@ when VOID the prescribed array dimensions (defined and undefined)
208210
/**
209211
* Create an array of the dimensions specified in dimensionsNode. dimensionsNode may contain a
210212
* number of "undefined" as well as "defined" dimensions.
211-
*
213+
* <p>
212214
* <p>Background: in Java arrays are implemented in arrays-of-arrays style where, for example, a
213215
* two dimensional array is a an array of arrays of some base type. Each dimension-type has a
214216
* Java class type associated with it... so if foo = new int[5][5] then the type of foo is int
@@ -217,7 +219,7 @@ when VOID the prescribed array dimensions (defined and undefined)
217219
* if foo = new int [5][]; then foo[0] == null //true; and can later be assigned with the
218220
* appropriate type, e.g. foo[0] = new int[5]; (See Learning Java, O'Reilly & Associates more
219221
* background).
220-
*
222+
* <p>
221223
* <p>To create an array with undefined trailing dimensions using the reflection API we must use
222224
* an array type to represent the lower order (undefined) dimensions as the "base" type for the
223225
* array creation... Java will then create the correct type by adding the dimensions of the base

app/src/main/java/bsh/BSHArguments.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class BSHArguments extends SimpleNode {
77

88
/**
99
* This node holds a set of arguments for a method invocation or constructor call.
10-
*
10+
* <p>
1111
* <p>Note: arguments are not currently allowed to be VOID.
1212
*/
1313
/*

app/src/main/java/bsh/BSHArrayDimensions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public Object eval(Class type, CallStack callstack, Interpreter interpreter) thr
3636

3737
/**
3838
* Evaluate the structure of the array in one of two ways:
39-
*
39+
* <p>
4040
* <p>a) an initializer exists, evaluate it and return the fully constructed array object, also
4141
* record the dimensions of that array
42-
*
42+
* <p>
4343
* <p>b) evaluate and record the lengths in each dimension and return void.
44-
*
44+
* <p>
4545
* <p>The structure of the array dims is maintained in dimensions.
4646
*/
4747
public Object eval(CallStack callstack, Interpreter interpreter) throws EvalError {

app/src/main/java/bsh/BSHArrayInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public Object eval(CallStack callstack, Interpreter interpreter) throws EvalErro
1414
/**
1515
* Construct the array from the initializer syntax.
1616
*
17-
* @param baseType the base class type of the array (no dimensionality)
17+
* @param baseType the base class type of the array (no dimensionality)
1818
* @param dimensions the top number of dimensions of the array e.g. 2 for a String [][];
1919
*/
2020
public Object eval(Class baseType, int dimensions, CallStack callstack, Interpreter interpreter)

app/src/main/java/bsh/BSHAssignment.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Object eval(CallStack callstack, Interpreter interpreter) throws EvalErro
2121
// e.g. i=1; i+=i++; // should be 2 not 3
2222
Object lhsValue = null;
2323
if (operator != ASSIGN) // assign doesn't need the pre-value
24-
try {
24+
try {
2525
lhsValue = lhs.getValue();
2626
} catch (UtilEvalError e) {
2727
throw e.toEvalError(this, callstack);
@@ -110,13 +110,13 @@ else if (lhs == Primitive.NULL || rhs == Primitive.NULL)
110110
throw new UtilEvalError("对空对象或'null'字面的非法使用");
111111

112112
if ((lhs instanceof Boolean
113-
|| lhs instanceof Character
114-
|| lhs instanceof Number
115-
|| lhs instanceof Primitive)
113+
|| lhs instanceof Character
114+
|| lhs instanceof Number
115+
|| lhs instanceof Primitive)
116116
&& (rhs instanceof Boolean
117-
|| rhs instanceof Character
118-
|| rhs instanceof Number
119-
|| rhs instanceof Primitive)) {
117+
|| rhs instanceof Character
118+
|| rhs instanceof Number
119+
|| rhs instanceof Primitive)) {
120120
return Primitive.binaryOperation(lhs, rhs, kind);
121121
}
122122

app/src/main/java/bsh/BSHBlock.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public Object eval(CallStack callstack, Interpreter interpreter) throws EvalErro
1414

1515
/**
1616
* @param overrideNamespace if set to true the block will be executed in the current namespace
17-
* (not a subordinate one).
18-
* <p>If true *no* new BlockNamespace will be swapped onto the stack and the eval will
19-
* happen in the current top namespace. This is used by BshMethod, TryStatement, etc. which
20-
* must intialize the block first and also for those that perform multiple passes in the
21-
* same block.
17+
* (not a subordinate one).
18+
* <p>If true *no* new BlockNamespace will be swapped onto the stack and the eval will
19+
* happen in the current top namespace. This is used by BshMethod, TryStatement, etc. which
20+
* must intialize the block first and also for those that perform multiple passes in the
21+
* same block.
2222
*/
2323
public Object eval(CallStack callstack, Interpreter interpreter, boolean overrideNamespace)
2424
throws EvalError {
@@ -31,7 +31,7 @@ public Object eval(CallStack callstack, Interpreter interpreter, boolean overrid
3131

3232
Object ret;
3333
if (isSynchronized) // Do the actual synchronization
34-
synchronized (syncValue) {
34+
synchronized (syncValue) {
3535
ret = evalBlock(callstack, interpreter, overrideNamespace, null);
3636
}
3737
else ret = evalBlock(callstack, interpreter, overrideNamespace, null);

app/src/main/java/bsh/BSHCastExpression.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* Implement casts.
5-
*
5+
* <p>
66
* <p>I think it should be possible to simplify some of the code here by using the
77
* Types.getAssignableForm() method, but I haven't looked into it.
88
*/
@@ -12,7 +12,9 @@ public BSHCastExpression(int id) {
1212
super(id);
1313
}
1414

15-
/** @return the result of the cast. */
15+
/**
16+
* @return the result of the cast.
17+
*/
1618
public Object eval(CallStack callstack, Interpreter interpreter) throws EvalError {
1719
NameSpace namespace = callstack.top();
1820
Class toType = ((BSHType) jjtGetChild(0)).getType(callstack, interpreter);

app/src/main/java/bsh/BSHForStatement.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package bsh;
22

3-
/** Implementation of the for(;;) statement. */
3+
/**
4+
* Implementation of the for(;;) statement.
5+
*/
46
class BSHForStatement extends SimpleNode implements ParserConstants {
57
public boolean hasForInit;
68
public boolean hasExpression;
@@ -23,7 +25,7 @@ public Object eval(CallStack callstack, Interpreter interpreter) throws EvalErro
2325
if (hasExpression) expression = ((SimpleNode) jjtGetChild(i++));
2426
if (hasForUpdate) forUpdate = ((SimpleNode) jjtGetChild(i++));
2527
if (i < jjtGetNumChildren()) // should normally be
26-
statement = ((SimpleNode) jjtGetChild(i));
28+
statement = ((SimpleNode) jjtGetChild(i));
2729

2830
NameSpace enclosingNameSpace = callstack.top();
2931
BlockNameSpace forNameSpace = new BlockNameSpace(enclosingNameSpace);

app/src/main/java/bsh/BSHFormalParameter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package bsh;
22

3-
/** A formal parameter declaration. For loose variable declaration type is null. */
3+
/**
4+
* A formal parameter declaration. For loose variable declaration type is null.
5+
*/
46
class BSHFormalParameter extends SimpleNode {
57
public static final Class UNTYPED = null;
68
public String name;
@@ -21,7 +23,9 @@ public String getTypeDescriptor(
2123
return "Ljava/lang/Object;"; // Object type
2224
}
2325

24-
/** Evaluate the type. */
26+
/**
27+
* Evaluate the type.
28+
*/
2529
public Object eval(CallStack callstack, Interpreter interpreter) throws EvalError {
2630
if (jjtGetNumChildren() > 0)
2731
type = ((BSHType) jjtGetChild(0)).getType(callstack, interpreter);

app/src/main/java/bsh/BSHFormalParameters.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package bsh;
22

33
class BSHFormalParameters extends SimpleNode {
4-
private String[] paramNames;
5-
/** For loose type parameters the paramTypes are null. */
4+
/**
5+
* For loose type parameters the paramTypes are null.
6+
*/
67
// unsafe caching of types
78
Class[] paramTypes;
8-
99
int numArgs;
1010
String[] typeDescriptors;
11+
private String[] paramNames;
1112

1213
BSHFormalParameters(int id) {
1314
super(id);
@@ -48,7 +49,9 @@ public String[] getTypeDescriptors(
4849
return typeDesc;
4950
}
5051

51-
/** Evaluate the types. Note that type resolution does not require the interpreter instance. */
52+
/**
53+
* Evaluate the types. Note that type resolution does not require the interpreter instance.
54+
*/
5255
public Object eval(CallStack callstack, Interpreter interpreter) throws EvalError {
5356
if (paramTypes != null) return paramTypes;
5457

0 commit comments

Comments
 (0)