From 3578202b39ce063bfd1eeef60d3babf91e4cc4c0 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 17 Feb 2011 17:07:30 +0100 Subject: [PATCH] IDEA-65657 (better check applicability) --- .../intention/impl/InsertLiteralUnderscoresAction.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/InsertLiteralUnderscoresAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/InsertLiteralUnderscoresAction.java index 40762fde4f14..281a18d78abc 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/InsertLiteralUnderscoresAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/InsertLiteralUnderscoresAction.java @@ -39,7 +39,10 @@ public class InsertLiteralUnderscoresAction extends PsiElementBaseIntentionActio !PsiType.FLOAT.equals(type) && !PsiType.DOUBLE.equals(type)) return false; final String text = literalExpression.getText(); - return text != null && !text.contains("_"); + if (text == null || text.contains("_")) return false; + + final String converted = LiteralFormatUtil.format(text, type); + return converted.length() != text.length(); } @Override