未验证 提交 3e32532e 编写于 作者: S SeanCai 提交者: GitHub

Merge pull request #255 from SeanCai/master

pr for bug fix and new version
......@@ -2,7 +2,7 @@
<feature
id="com.alibaba.smartfox.eclipse.feature"
label="%feature.label"
version="1.0.3.qualifier"
version="1.0.4.qualifier"
provider-name="%feature.provider_name"
plugin="com.alibaba.smartfox.eclipse.plugin"
image="smartfox.png">
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
</parent>
<artifactId>com.alibaba.smartfox.eclipse.feature</artifactId>
<packaging>eclipse-feature</packaging>
......
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.alibaba.smartfox.eclipse.plugin
Bundle-SymbolicName: com.alibaba.smartfox.eclipse.plugin;singleton:=true
Bundle-Version: 1.0.3.qualifier
Bundle-Version: 1.0.4.qualifier
Bundle-Activator: com.alibaba.smartfox.eclipse.SmartfoxActivator
Bundle-Vendor: Alibaba
Require-Bundle: org.eclipse.ui,
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
</parent>
<artifactId>com.alibaba.smartfox.eclipse.plugin</artifactId>
<packaging>eclipse-plugin</packaging>
......@@ -22,7 +22,7 @@
<dependency>
<groupId>com.alibaba.p3c</groupId>
<artifactId>p3c-pmd</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
......
......@@ -35,7 +35,8 @@ class AvoidAccessStaticViaInstanceRule : AbstractEclipseRule() {
override fun getVisitor(ast: CompilationUnit, ruleContext: RuleContext): ASTVisitor {
return object : ASTVisitor() {
override fun visit(node: QualifiedName?): Boolean {
if (node!!.parent !is MethodInvocation && node.parent !is VariableDeclarationFragment) {
val parent = node!!.parent
if (parent !is MethodInvocation && parent !is VariableDeclarationFragment) {
return false
}
val name = node.name
......@@ -45,9 +46,25 @@ class AvoidAccessStaticViaInstanceRule : AbstractEclipseRule() {
}
val qualifier = node.qualifier
val typeBinding = qualifier.resolveTypeBinding()
if (qualifier.isSimpleName && typeBinding.name != qualifier.fullyQualifiedName) {
violation(ruleContext, node, ast)
return false
if (qualifier.isSimpleName) {
when (parent) {
is MethodInvocation -> {
val methodBinding = parent.resolveMethodBinding()
val methodTypeBinding = methodBinding.declaringClass
if (methodBinding.modifiers and Modifier.STATIC != 0
&& qualifier.fullyQualifiedName != methodTypeBinding.name
&& methodTypeBinding == typeBinding && binding.name != typeBinding.name) {
violation(ruleContext, parent, ast)
return false
}
}
else -> {
}
}
if (typeBinding.name != qualifier.fullyQualifiedName) {
violation(ruleContext, node, ast)
return false
}
}
if (qualifier.isQualifiedName) {
val qualifiedName = qualifier as QualifiedName
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
</parent>
<artifactId>com.alibaba.smartfox.eclipse.updatesite</artifactId>
<packaging>eclipse-repository</packaging>
......
......@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba.smartfox.eclipse</groupId>
<artifactId>smartfox-eclipse</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
<packaging>pom</packaging>
<inceptionYear>2017</inceptionYear>
<properties>
......@@ -14,7 +14,7 @@
<eclipse-repo.url>http://download.eclipse.org/releases/neon</eclipse-repo.url>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ajdt-eclipse-repo.url>http://download.eclipse.org/tools/ajdt/46/dev/update</ajdt-eclipse-repo.url>
<kotlin.version>1.2.0</kotlin.version>
<kotlin.version>1.2.21</kotlin.version>
<eclipse-release>juno</eclipse-release>
</properties>
<modules>
......
kotlin_version=1.2.0
kotlin_version=1.2.21
#idea_version=171.3780.15
idea_version=14.1.7
plugin_name=Alibaba Java Coding Guidelines
......@@ -6,4 +6,4 @@ pmd_version=5.5.2
gradle_jetbrains_version=0.2.13
systemProp.file.encoding=UTF-8
plugin_version=1.0.3
plugin_version=1.0.4
......@@ -38,7 +38,7 @@ ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
dependencies {
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.25-incubating'
compile 'com.alibaba.p3c:p3c-pmd:1.3.3'
compile 'com.alibaba.p3c:p3c-pmd:1.3.4'
compile group: 'org.javassist', name: 'javassist', version: '3.21.0-GA'
}
......
......@@ -5,6 +5,11 @@
<change-notes>
<![CDATA[
<ul>
1.0.4
<li>fix https://github.com/alibaba/p3c/issues/217</li>
<li>fix https://github.com/alibaba/p3c/issues/208</li>
<li>fix https://github.com/alibaba/p3c/issues/195</li>
<ul>
1.0.3
<li>fix <a href="https://github.com/alibaba/p3c/issues/191">https://github.com/alibaba/p3c/issues/191</a></li>
......
......@@ -9,7 +9,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba.p3c</groupId>
<artifactId>p3c-pmd</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
<packaging>jar</packaging>
<name>p3c-pmd</name>
<properties>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册