mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
unused declaration: patterns fix (IDEA-160807)
This commit is contained in:
+1
-1
@@ -590,7 +590,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
|
||||
}
|
||||
|
||||
private static Pattern createRegexp(final String pattern) {
|
||||
final String replace = pattern.replace("*", ".*").replace(".", "\\.");
|
||||
final String replace = pattern.replace(".", "\\.").replace("*", ".*");
|
||||
try {
|
||||
return Pattern.compile(replace);
|
||||
}
|
||||
|
||||
+38
-2
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.codeInspection;
|
||||
package com.intellij.codeInspection
|
||||
|
||||
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection
|
||||
import com.intellij.codeInspection.ex.EntryPointsManagerBase
|
||||
@@ -27,7 +27,7 @@ class UnusedDeclarationClassPatternsTest : LightCodeInsightFixtureTestCase() {
|
||||
val unusedDeclarationInspection = UnusedDeclarationInspection(true)
|
||||
myFixture.enableInspections(unusedDeclarationInspection)
|
||||
val classPattern = EntryPointsManagerBase.ClassPattern()
|
||||
classPattern.hierarchically = true;
|
||||
classPattern.hierarchically = true
|
||||
classPattern.pattern = "java.lang.Runnable"
|
||||
val patterns = EntryPointsManagerBase.getInstance(project).patterns
|
||||
try {
|
||||
@@ -41,6 +41,42 @@ class UnusedDeclarationClassPatternsTest : LightCodeInsightFixtureTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
fun testMethodPattern() {
|
||||
val unusedDeclarationInspection = UnusedDeclarationInspection(true)
|
||||
myFixture.enableInspections(unusedDeclarationInspection)
|
||||
val classPattern = EntryPointsManagerBase.ClassPattern()
|
||||
classPattern.pattern = "C"
|
||||
classPattern.method = "*"
|
||||
val patterns = EntryPointsManagerBase.getInstance(project).patterns
|
||||
try {
|
||||
patterns.add(classPattern)
|
||||
myFixture.configureByText("C.java", "public abstract class C { void foo() {} public static void main(String[] args) {}}")
|
||||
myFixture.checkHighlighting()
|
||||
}
|
||||
finally {
|
||||
patterns.remove(classPattern)
|
||||
myFixture.disableInspections(unusedDeclarationInspection)
|
||||
}
|
||||
}
|
||||
|
||||
fun testMethodPattern1() {
|
||||
val unusedDeclarationInspection = UnusedDeclarationInspection(true)
|
||||
myFixture.enableInspections(unusedDeclarationInspection)
|
||||
val classPattern = EntryPointsManagerBase.ClassPattern()
|
||||
classPattern.pattern = "C"
|
||||
classPattern.method = "foo*"
|
||||
val patterns = EntryPointsManagerBase.getInstance(project).patterns
|
||||
try {
|
||||
patterns.add(classPattern)
|
||||
myFixture.configureByText("C.java", "public abstract class C { void fooBar() {} public static void main(String[] args) {}}")
|
||||
myFixture.checkHighlighting()
|
||||
}
|
||||
finally {
|
||||
patterns.remove(classPattern)
|
||||
myFixture.disableInspections(unusedDeclarationInspection)
|
||||
}
|
||||
}
|
||||
|
||||
fun testNoClassPattern() {
|
||||
val unusedDeclarationInspection = UnusedDeclarationInspection(true)
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user