diff --git a/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/feature.xml b/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/feature.xml index ffbe62f070128ff04a32643360114ab26c873711..552fc5ef5390f98525e5408c0844e04bed9ddf22 100644 --- a/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/feature.xml +++ b/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/pom.xml b/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/pom.xml index 30ba5b0ae731973ec7e0b1b7a1f76420d42a11a5..0203765a4f360bcd6b8deffe25a4d4c183139eef 100644 --- a/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/pom.xml +++ b/eclipse-plugin/com.alibaba.smartfox.eclipse.feature/pom.xml @@ -5,7 +5,7 @@ com.alibaba.smartfox.eclipse smartfox-eclipse - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT com.alibaba.smartfox.eclipse.feature eclipse-feature diff --git a/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/META-INF/MANIFEST.MF b/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/META-INF/MANIFEST.MF index 94d5f23afc015d4365ec89f3a8ec236c679e2f0f..3a696bca3ce3b676ba1065a816375e4591296661 100644 --- a/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/META-INF/MANIFEST.MF +++ b/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/META-INF/MANIFEST.MF @@ -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, diff --git a/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/pom.xml b/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/pom.xml index 3b01a93f5f9bb340b055303b0df16a4b39ca633e..5b461cd345cd067bb75f1d1a08b7648bcdd798fa 100644 --- a/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/pom.xml +++ b/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/pom.xml @@ -5,7 +5,7 @@ com.alibaba.smartfox.eclipse smartfox-eclipse - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT com.alibaba.smartfox.eclipse.plugin eclipse-plugin @@ -22,7 +22,7 @@ com.alibaba.p3c p3c-pmd - 1.3.3 + 1.3.4 org.jetbrains.kotlin diff --git a/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/src/main/kotlin/com/alibaba/smartfox/eclipse/pmd/rule/AvoidAccessStaticViaInstanceRule.kt b/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/src/main/kotlin/com/alibaba/smartfox/eclipse/pmd/rule/AvoidAccessStaticViaInstanceRule.kt index 48ec34be29520459a10c23e861eb628a098cddd7..44d7fd7ef87846164b7c6b2d00cd02038c881b85 100644 --- a/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/src/main/kotlin/com/alibaba/smartfox/eclipse/pmd/rule/AvoidAccessStaticViaInstanceRule.kt +++ b/eclipse-plugin/com.alibaba.smartfox.eclipse.plugin/src/main/kotlin/com/alibaba/smartfox/eclipse/pmd/rule/AvoidAccessStaticViaInstanceRule.kt @@ -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 diff --git a/eclipse-plugin/com.alibaba.smartfox.eclipse.updatesite/pom.xml b/eclipse-plugin/com.alibaba.smartfox.eclipse.updatesite/pom.xml index f8f8d3b20c88b19bca92e9157cd95caae06ac1aa..aecaa4c4572b831169a0940d43eb9e161a778b16 100644 --- a/eclipse-plugin/com.alibaba.smartfox.eclipse.updatesite/pom.xml +++ b/eclipse-plugin/com.alibaba.smartfox.eclipse.updatesite/pom.xml @@ -5,7 +5,7 @@ com.alibaba.smartfox.eclipse smartfox-eclipse - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT com.alibaba.smartfox.eclipse.updatesite eclipse-repository diff --git a/eclipse-plugin/pom.xml b/eclipse-plugin/pom.xml index c5dcc65cff16f847e282625100bb36d75f06ed8f..868ee64c270c95678bcf01891e857cd6f7757750 100644 --- a/eclipse-plugin/pom.xml +++ b/eclipse-plugin/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.alibaba.smartfox.eclipse smartfox-eclipse - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT pom 2017 @@ -14,7 +14,7 @@ http://download.eclipse.org/releases/neon UTF-8 http://download.eclipse.org/tools/ajdt/46/dev/update - 1.2.0 + 1.2.21 juno diff --git a/idea-plugin/gradle.properties b/idea-plugin/gradle.properties index 7d4496d5cbdf3d5d8d1a4d7afb6ffe942f19a26d..89d914504f07a13292785a2e30fb3bc74fb7eaed 100644 --- a/idea-plugin/gradle.properties +++ b/idea-plugin/gradle.properties @@ -1,4 +1,4 @@ -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 diff --git a/idea-plugin/p3c-common/build.gradle b/idea-plugin/p3c-common/build.gradle index 3c3620b6f2c502287b854bb1e2d7ca6e959630bb..1b2f2d00f419358632e11baa4264bd817ac059d0 100644 --- a/idea-plugin/p3c-common/build.gradle +++ b/idea-plugin/p3c-common/build.gradle @@ -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' } diff --git a/idea-plugin/p3c-idea/src/main/resources/META-INF/plugin.xml b/idea-plugin/p3c-idea/src/main/resources/META-INF/plugin.xml index 56a5fb1bac4cacaf8af6ba3b0cdd1f21f94ff1c9..f6bfe629336224f7cb57af289ef95081af2d3e78 100755 --- a/idea-plugin/p3c-idea/src/main/resources/META-INF/plugin.xml +++ b/idea-plugin/p3c-idea/src/main/resources/META-INF/plugin.xml @@ -5,6 +5,11 @@ + 1.0.4 +
  • fix https://github.com/alibaba/p3c/issues/217
  • +
  • fix https://github.com/alibaba/p3c/issues/208
  • +
  • fix https://github.com/alibaba/p3c/issues/195
    • 1.0.3
    • fix https://github.com/alibaba/p3c/issues/191
    • diff --git a/p3c-pmd/pom.xml b/p3c-pmd/pom.xml index 9238167675ff774cc8f9a38ec293856d8470427b..9b3a50b639038563c790f6951ace0735fa6f70fa 100644 --- a/p3c-pmd/pom.xml +++ b/p3c-pmd/pom.xml @@ -9,7 +9,7 @@ 4.0.0 com.alibaba.p3c p3c-pmd - 1.3.3 + 1.3.4 jar p3c-pmd