Fix for 866501 (Inconsistent lcurly new line on wrap). Some grammar changes made to fix this problem.
This commit is contained in:
parent
bbd5145467
commit
d2fb67faae
|
|
@ -96,6 +96,9 @@
|
|||
<li class="body">FinalParameter now reports column of start of
|
||||
parameter declaration. (bug 864900)</li>
|
||||
|
||||
<li class="body">Fixed inconsistent handling of NLOW (new
|
||||
line on wrap) option by LeftCurly check. (bug 866501)</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<a name="release3_3"></a>
|
||||
|
|
|
|||
|
|
@ -338,6 +338,7 @@ public final class TokenTypes
|
|||
* +--MODIFIERS
|
||||
* |
|
||||
* +--LITERAL_PUBLIC (public)
|
||||
* +--LITERAL_CLASS (class)
|
||||
* +--IDENT (MyClass)
|
||||
* +--EXTENDS_CLAUSE
|
||||
* +--IMPLEMENTS_CLAUSE
|
||||
|
|
@ -380,6 +381,7 @@ public final class TokenTypes
|
|||
* +--MODIFIERS
|
||||
* |
|
||||
* +--LITERAL_PUBLIC (public)
|
||||
* +--LITERAL_INTERFACE (interface)
|
||||
* +--IDENT (MyInterface)
|
||||
* +--EXTENDS_CLAUSE
|
||||
* +--OBJBLOCK
|
||||
|
|
@ -1310,8 +1312,8 @@ public final class TokenTypes
|
|||
GeneratedJava14TokenTypes.LITERAL_volatile;
|
||||
|
||||
/**
|
||||
* The <code>class</code> keyword. This element does not appear
|
||||
* as part of a class declaration, but only inline to reference a
|
||||
* The <code>class</code> keyword. This element appears both
|
||||
* as part of a class declaration, and inline to reference a
|
||||
* class object.
|
||||
*
|
||||
* <p>For example:</p>
|
||||
|
|
@ -1345,13 +1347,14 @@ public final class TokenTypes
|
|||
//public static final int LITERAL_EXTENDS =
|
||||
// GeneratedJava14TokenTypes.LITERAL_extends;
|
||||
|
||||
/* *
|
||||
* This token does not appear in the tree.
|
||||
/**
|
||||
* The <code>interface</code> keyword. This token appears in
|
||||
* interface definition.
|
||||
*
|
||||
* @see #INTERFACE_DEF
|
||||
**/
|
||||
//public static final int LITERAL_INTERFACE =
|
||||
// GeneratedJava14TokenTypes.LITERAL_interface;
|
||||
public static final int LITERAL_INTERFACE =
|
||||
GeneratedJava14TokenTypes.LITERAL_interface;
|
||||
|
||||
/**
|
||||
* A left (curly) brace (<code>{</code>).
|
||||
|
|
|
|||
|
|
@ -128,8 +128,7 @@ public class LeftCurlyCheck
|
|||
|
||||
case TokenTypes.INTERFACE_DEF :
|
||||
case TokenTypes.CLASS_DEF :
|
||||
// TODO: should check for modifiers
|
||||
startToken = (DetailAST) aAST.getFirstChild().getNextSibling();
|
||||
startToken = (DetailAST) aAST.getFirstChild();
|
||||
brace = (DetailAST) aAST.getLastChild().getFirstChild();
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -188,15 +188,17 @@ modifier
|
|||
|
||||
// Definition of a Java class
|
||||
classDefinition![AST modifiers]
|
||||
: "class" IDENT
|
||||
: c:"class" IDENT
|
||||
// it _might_ have a superclass...
|
||||
sc:superClassClause
|
||||
// it might implement some interfaces...
|
||||
ic:implementsClause
|
||||
// now parse the body of the class
|
||||
cb:classBlock
|
||||
{#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"],
|
||||
modifiers,IDENT,sc,ic,cb);}
|
||||
{
|
||||
#classDefinition = #(#[CLASS_DEF,"CLASS_DEF"],
|
||||
modifiers, c, IDENT, sc, ic, cb);
|
||||
}
|
||||
;
|
||||
|
||||
superClassClause!
|
||||
|
|
@ -206,13 +208,15 @@ superClassClause!
|
|||
|
||||
// Definition of a Java Interface
|
||||
interfaceDefinition![AST modifiers]
|
||||
: "interface" IDENT
|
||||
: i:"interface" IDENT
|
||||
// it might extend some other interfaces
|
||||
ie:interfaceExtends
|
||||
// now parse the body of the interface (looks like a class...)
|
||||
cb:classBlock
|
||||
{#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"],
|
||||
modifiers,IDENT,ie,cb);}
|
||||
{
|
||||
#interfaceDefinition = #(#[INTERFACE_DEF,"INTERFACE_DEF"],
|
||||
modifiers, i, IDENT, ie, cb);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,4 +44,21 @@ public class InputScopeInnerInterfaces
|
|||
void mb();
|
||||
}
|
||||
|
||||
private
|
||||
class
|
||||
MyClass1 {
|
||||
}
|
||||
|
||||
class
|
||||
MyClass2 {
|
||||
}
|
||||
|
||||
private
|
||||
interface
|
||||
MyInterface1 {
|
||||
}
|
||||
|
||||
interface
|
||||
MyInterface2 {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ public class LeftCurlyCheckTest
|
|||
createCheckConfig(LeftCurlyCheck.class);
|
||||
checkConfig.addAttribute("option", LeftCurlyOption.NL.toString());
|
||||
final String[] expected = {
|
||||
"49:14: '{' should be on a new line.",
|
||||
"53:14: '{' should be on a new line.",
|
||||
"58:18: '{' should be on a new line.",
|
||||
"62:18: '{' should be on a new line.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected);
|
||||
}
|
||||
|
|
@ -44,6 +48,10 @@ public class LeftCurlyCheckTest
|
|||
"21:5: '{' should be on the previous line.",
|
||||
"30:5: '{' should be on the previous line.",
|
||||
"39:5: '{' should be on the previous line.",
|
||||
"49:14: '{' should be on a new line.",
|
||||
"53:14: '{' should be on a new line.",
|
||||
"58:18: '{' should be on a new line.",
|
||||
"62:18: '{' should be on a new line.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue