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
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ public Object visit(ASTImportDeclaration node, Object data) {
@Override
public Object visit(ASTVariableDeclarator node, Object data) {
ASTType typeNode = node.getParent().getFirstChildOfType(ASTType.class);
Node reftypeNode = typeNode.getChild(0);
if (reftypeNode instanceof ASTReferenceType) {
ASTClassOrInterfaceType classOrInterfaceType = reftypeNode
.getFirstChildOfType(ASTClassOrInterfaceType.class);
if (classOrInterfaceType != null) {
String className = classOrInterfaceType.getImage();
if (typeNode != null) {
Node reftypeNode = typeNode.getChild(0);
if (reftypeNode instanceof ASTReferenceType) {
ASTClassOrInterfaceType classOrInterfaceType = reftypeNode
.getFirstChildOfType(ASTClassOrInterfaceType.class);
if (classOrInterfaceType != null) {
String className = classOrInterfaceType.getImage();

if (isClassNameForbidden(className)) {
addViolation(data, typeNode);
if (isClassNameForbidden(className)) {
addViolation(data, typeNode);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ class Foo{
]]></code>
</test-code>
<test-code reinitializeRule="true" regressionTest="true">
<description>Real smarthome class</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
<description>Real smarthome class</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
/**
* Copyright (c) 2014,2018 Contributors to the Eclipse Foundation
*
Expand Down Expand Up @@ -189,7 +189,20 @@ public class RawType implements PrimitiveType, State {
}

}

]]></code>
]]></code>
</test-code>
<test-code reinitializeRule="true" regressionTest="true">
<description>Unresolved inferred var types</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
class Foo {
Foo() {
var oh = "openHAB";
var obj1 = new Object();
var obj2 = null;
var i = 1;
}
}
]]></code>
</test-code>
</test-data>