mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
sort 'default' modifier correctly in "Missorted modifiers" inspection
This commit is contained in:
+9
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2007 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2015 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -221,13 +221,14 @@ public class MissortedModifiersInspection extends BaseInspection implements Clea
|
||||
s_modifierOrder.put(PsiModifier.PROTECTED, Integer.valueOf(1));
|
||||
s_modifierOrder.put(PsiModifier.PRIVATE, Integer.valueOf(2));
|
||||
s_modifierOrder.put(PsiModifier.ABSTRACT, Integer.valueOf(3));
|
||||
s_modifierOrder.put(PsiModifier.STATIC, Integer.valueOf(4));
|
||||
s_modifierOrder.put(PsiModifier.FINAL, Integer.valueOf(5));
|
||||
s_modifierOrder.put(PsiModifier.TRANSIENT, Integer.valueOf(6));
|
||||
s_modifierOrder.put(PsiModifier.VOLATILE, Integer.valueOf(7));
|
||||
s_modifierOrder.put(PsiModifier.SYNCHRONIZED, Integer.valueOf(8));
|
||||
s_modifierOrder.put(PsiModifier.NATIVE, Integer.valueOf(9));
|
||||
s_modifierOrder.put(PsiModifier.STRICTFP, Integer.valueOf(10));
|
||||
s_modifierOrder.put(PsiModifier.DEFAULT, Integer.valueOf(4));
|
||||
s_modifierOrder.put(PsiModifier.STATIC, Integer.valueOf(5));
|
||||
s_modifierOrder.put(PsiModifier.FINAL, Integer.valueOf(6));
|
||||
s_modifierOrder.put(PsiModifier.TRANSIENT, Integer.valueOf(7));
|
||||
s_modifierOrder.put(PsiModifier.VOLATILE, Integer.valueOf(8));
|
||||
s_modifierOrder.put(PsiModifier.SYNCHRONIZED, Integer.valueOf(9));
|
||||
s_modifierOrder.put(PsiModifier.NATIVE, Integer.valueOf(10));
|
||||
s_modifierOrder.put(PsiModifier.STRICTFP, Integer.valueOf(11));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Hashtable;
|
||||
|
||||
|
||||
class MissortedModifiers {
|
||||
<warning descr="Missorted modifiers 'private native static'">private native static</warning> int foo2();
|
||||
|
||||
<warning descr="Missorted modifiers 'static private'">static private</warning> int m_bar = 4;
|
||||
<warning descr="Missorted modifiers 'static public'">static public</warning> int m_baz = 4;
|
||||
<warning descr="Missorted modifiers 'static final public'">static final public</warning> int m_baz2 = 4;
|
||||
static final int m_baz3 = 4;
|
||||
|
||||
<warning descr="Missorted modifiers 'static public'">static public</warning> void foo(){}
|
||||
|
||||
<warning descr="Missorted modifiers 'static public'">static public</warning> class Foo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
<warning descr="Missorted modifiers 'public @Deprecated'">public @Deprecated</warning> void foo3(){};
|
||||
|
||||
<warning descr="Missorted modifiers 'private transient static'">private transient static</warning> Hashtable mAttributeMeta;
|
||||
|
||||
interface A {
|
||||
|
||||
<warning descr="Missorted modifiers 'default public'">default public</warning> double f() {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
<warning descr="Missorted modifiers 'final public'">final public</warning> class TestQuickFix
|
||||
{
|
||||
<warning descr="Missorted modifiers 'protected final static'">protected final static</warning> String A = "a";
|
||||
<warning descr="Missorted modifiers 'protected final static'">protected final static</warning> String B = "b";
|
||||
<warning descr="Missorted modifiers 'protected final static'">protected final static</warning> String C = "c";
|
||||
<warning descr="Missorted modifiers 'protected final static'">protected final static</warning> String D = "d";
|
||||
}
|
||||
|
||||
//@Type(type = "org.joda.time.contrib.hibernate.PersistentYearMonthDay")
|
||||
//@Column(name = "current_month")
|
||||
<warning descr="Missorted modifiers 'final public @Nullable // commment @NotNull'">final
|
||||
public
|
||||
@Nullable
|
||||
// commment
|
||||
@NotNull</warning>
|
||||
int //@Temporal(TemporalType.DATE)
|
||||
x() {return -1;}
|
||||
}
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface ReadOnly {}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class MissortedModifiersInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void testMissortedModifiers() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new MissortedModifiersInspection();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user