mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-22 14:31:25 +07:00
IJPF-CR-24873 IJ-CR-145218 [java-inspections] IDEA-201932 Provide inspection to highlight redundant creation operations in java date time api
GitOrigin-RevId: 5af6c994aca832256f73eaa301cc21f6bb738316
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fdb7551670
commit
1512d52efd
@@ -1675,7 +1675,7 @@ redundant.string.format.call.display.name=Redundant call to 'String.format()'
|
||||
redundant.call.problem.descriptor=Redundant call to <code>#ref()</code> #loc
|
||||
inspection.redundant.java.time.operation.display.name=Redundant operation on 'java.time' object
|
||||
inspection.redundant.java.time.operation.explicit.chrono.field.family.name=Simplify calls with explicit 'ChronoField' or 'ChronoUnit' arguments
|
||||
inspection.redundant.java.time.operation.explicit.chrono.field.problem.descriptor=Calls with explicit 'ChronoField' or 'ChronoUnit' arguments call can be simplified
|
||||
inspection.redundant.java.time.operation.explicit.chrono.field.problem.descriptor=Calls with explicit 'ChronoField' or 'ChronoUnit' arguments can be simplified
|
||||
inspection.redundant.java.time.operation.creation.java.time.redundant.call.message=Redundant ''{0}'' call
|
||||
inspection.redundant.java.time.operation.creation.java.time.error.message=Redundant creation of ''{0}'' object
|
||||
inspection.redundant.java.time.operation.creation.java.time.error.remove.fix.message=Remove ''{0}'' call
|
||||
|
||||
@@ -5,6 +5,6 @@ import java.time.temporal.ChronoField;
|
||||
class Main {
|
||||
|
||||
public static int test(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTime.<warning descr="Calls with explicit 'ChronoField' or 'ChronoUnit' arguments call can be simplified">get<caret></warning>(ChronoField.NANO_OF_SECOND);
|
||||
return offsetDateTime.<warning descr="Calls with explicit 'ChronoField' or 'ChronoUnit' arguments can be simplified">get<caret></warning>(ChronoField.NANO_OF_SECOND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ import java.time.temporal.ChronoField;
|
||||
class Main {
|
||||
|
||||
public static int test(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTime.<warning descr="Calls with explicit 'ChronoField' or 'ChronoUnit' arguments call can be simplified">get<caret></warning>(ChronoField.NANO_OF_SECOND);
|
||||
return offsetDateTime.<warning descr="Calls with explicit 'ChronoField' or 'ChronoUnit' arguments can be simplified">get<caret></warning>(ChronoField.NANO_OF_SECOND);
|
||||
}
|
||||
public static int test2(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTime.get(ChronoField.INSTANT_SECONDS);
|
||||
}
|
||||
public static int test3(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTime.<warning descr="Calls with explicit 'ChronoField' or 'ChronoUnit' arguments call can be simplified">get</warning>(ChronoField.YEAR);
|
||||
return offsetDateTime.<warning descr="Calls with explicit 'ChronoField' or 'ChronoUnit' arguments can be simplified">get</warning>(ChronoField.YEAR);
|
||||
}
|
||||
public static void test4(OffsetTime time) {
|
||||
time.get(1, <error descr="Cannot resolve symbol 'ChronoUnit'">ChronoUnit</error>.YEARS);
|
||||
|
||||
Reference in New Issue
Block a user