diff --git a/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml b/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml
index e3817225b2d6..73c87c58a2dd 100644
--- a/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml
+++ b/plugins/IntentionPowerPak/IntentionPowerPackPlugin.iml
@@ -4,6 +4,7 @@
+
@@ -13,6 +14,7 @@
+
diff --git a/plugins/IntentionPowerPak/src/META-INF/plugin.xml b/plugins/IntentionPowerPak/src/META-INF/plugin.xml
index 2417a6d598e0..c1c1f3906840 100644
--- a/plugins/IntentionPowerPak/src/META-INF/plugin.xml
+++ b/plugins/IntentionPowerPak/src/META-INF/plugin.xml
@@ -35,6 +35,11 @@
intention.category.numbers
+
+ com.siyeh.ipp.integer.ConvertIntegerToBinaryIntention
+ intention.category.numbers
+
+
com.siyeh.ipp.bool.DemorgansIntention
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties
index 417a2db8cc71..ac0896aa51c6 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties
+++ b/plugins/IntentionPowerPak/src/com/siyeh/IntentionPowerPackBundle.properties
@@ -55,6 +55,8 @@ move.comment.to.separate.line.intention.name=Move comment to separate line
move.comment.to.separate.line.intention.family.name=Move Comment to Separate Line
convert.integer.to.hex.intention.name=Convert to hex
convert.integer.to.hex.intention.family.name=Convert to Hexadecimal
+convert.integer.to.binary.intention.name=Convert to binary
+convert.integer.to.binary.intention.family.name=Convert to Binary
convert.to.engineering.notation.intention.name=Convert to Engineering notation
convert.to.engineering.notation.intention.family.name=Convert to Engineering notation
convert.to.plain.intention.name=Convert to Plain
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToBinaryIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToBinaryIntention.java
new file mode 100644
index 000000000000..e7368c50fbcc
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToBinaryIntention.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-2011 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.ipp.integer;
+
+import com.intellij.psi.PsiType;
+import com.siyeh.ipp.base.PsiElementPredicate;
+import org.jetbrains.annotations.NotNull;
+
+public class ConvertIntegerToBinaryIntention extends ConvertNumberIntentionBase {
+ @Override
+ @NotNull
+ public PsiElementPredicate getElementPredicate() {
+ return new ConvertIntegerToBinaryPredicate();
+ }
+
+ @Override
+ protected String convertValue(final Number value, final PsiType type, final boolean negated) {
+ if (PsiType.INT.equals(type)) {
+ final int intValue = negated ? -value.intValue() : value.intValue();
+ return "0b" + Integer.toBinaryString(intValue);
+ }
+ else if (PsiType.LONG.equals(type)) {
+ final long longValue = negated ? -value.longValue() : value.longValue();
+ return "0b" + Long.toBinaryString(longValue) + "L";
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToBinaryPredicate.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToBinaryPredicate.java
new file mode 100644
index 000000000000..4491a173877e
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToBinaryPredicate.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2011 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.ipp.integer;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiLiteralExpression;
+import com.intellij.psi.PsiType;
+import com.intellij.psi.util.PsiUtil;
+import com.siyeh.ipp.base.PsiElementPredicate;
+
+class ConvertIntegerToBinaryPredicate implements PsiElementPredicate {
+ @Override
+ public boolean satisfiedBy(final PsiElement element) {
+ if (!(element instanceof PsiLiteralExpression)) {
+ return false;
+ }
+
+ if (!PsiUtil.isLanguageLevel7OrHigher(element)) {
+ return false;
+ }
+
+ final PsiType type = ((PsiLiteralExpression)element).getType();
+ if (PsiType.INT.equals(type) || PsiType.LONG.equals(type)) {
+ final String text = element.getText();
+ return !(text.startsWith("0b") || text.startsWith("0B"));
+ }
+
+ return false;
+ }
+}
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalIntention.java
index 0eeaa72e08e8..081faf07ef64 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalIntention.java
@@ -15,65 +15,36 @@
*/
package com.siyeh.ipp.integer;
-import com.intellij.psi.*;
-import com.intellij.util.IncorrectOperationException;
-import com.siyeh.ipp.base.Intention;
+import com.intellij.psi.PsiType;
import com.siyeh.ipp.base.PsiElementPredicate;
-import com.siyeh.ipp.psiutils.ExpressionUtils;
import org.jetbrains.annotations.NotNull;
-public class ConvertIntegerToDecimalIntention extends Intention {
+public class ConvertIntegerToDecimalIntention extends ConvertNumberIntentionBase {
+ @Override
+ @NotNull
+ public PsiElementPredicate getElementPredicate() {
+ return new ConvertIntegerToDecimalPredicate();
+ }
- @Override @NotNull
- public PsiElementPredicate getElementPredicate() {
- return new ConvertIntegerToDecimalPredicate();
+ @Override
+ protected String convertValue(final Number value, final PsiType type, final boolean negated) {
+ if (PsiType.INT.equals(type)) {
+ final int intValue = negated ? -value.intValue() : value.intValue();
+ return Integer.toString(intValue);
+ }
+ else if (PsiType.LONG.equals(type)) {
+ final long longValue = negated ? -value.longValue() : value.longValue();
+ return Long.toString(longValue) + "L";
+ }
+ else if (PsiType.FLOAT.equals(type)) {
+ final float floatValue = negated ? -value.floatValue() : value.floatValue();
+ return Float.toString(floatValue) + 'f';
+ }
+ else if (PsiType.DOUBLE.equals(type)) {
+ final double doubleValue = negated ? -value.doubleValue() : value.doubleValue();
+ return Double.toString(doubleValue);
}
- @Override
- public void processIntention(@NotNull PsiElement element)
- throws IncorrectOperationException {
- final PsiExpression expression = (PsiExpression)element;
- final boolean negated = ExpressionUtils.isNegated(expression);
- final Number value =
- (Number)ExpressionUtils.computeConstantExpression(expression);
- if (value == null) {
- return;
- }
- final PsiType type = expression.getType();
- final String decimalString;
- if (PsiType.INT.equals(type)) {
- if (negated) {
- decimalString = String.valueOf(-value.intValue());
- } else {
- decimalString = String.valueOf(value.intValue());
- }
- } else if (PsiType.LONG.equals(type)) {
- if (negated) {
- decimalString = String.valueOf(-value.longValue()) + 'L';
- } else {
- decimalString = String.valueOf(value.longValue()) + 'L';
- }
- } else if (PsiType.FLOAT.equals(type)) {
- if (negated) {
- decimalString = String.valueOf(-value.floatValue()) + 'f';
- } else {
- decimalString = String.valueOf(value.floatValue()) + 'f';
- }
- }
- else if (PsiType.DOUBLE.equals(type)) {
- if (negated) {
- decimalString = String.valueOf(-value.doubleValue());
- } else {
- decimalString = String.valueOf(value.doubleValue());
- }
- } else {
- return;
- }
- if (negated) {
- replaceExpression(decimalString,
- (PsiExpression)expression.getParent());
- } else {
- replaceExpression(decimalString, expression);
- }
- }
+ return null;
+ }
}
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalPredicate.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalPredicate.java
index c94ea7f2fd8b..8cc2e7484480 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalPredicate.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToDecimalPredicate.java
@@ -18,7 +18,6 @@ package com.siyeh.ipp.integer;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiLiteralExpression;
import com.intellij.psi.PsiType;
-import com.intellij.psi.util.PsiUtil;
import com.siyeh.ipp.base.PsiElementPredicate;
import org.jetbrains.annotations.NonNls;
@@ -41,9 +40,6 @@ class ConvertIntegerToDecimalPredicate implements PsiElementPredicate{
return text.charAt(0) == '0';
}
if(PsiType.DOUBLE.equals(type) || PsiType.FLOAT.equals(type)){
- if(!PsiUtil.isLanguageLevel5OrHigher(expression)){
- return false;
- }
@NonNls final String text = expression.getText();
if(text == null || text.length() < 2){
return false;
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToHexIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToHexIntention.java
index d5147608e712..abe0f363bbfd 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToHexIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToHexIntention.java
@@ -15,90 +15,36 @@
*/
package com.siyeh.ipp.integer;
-import com.intellij.psi.*;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.util.IncorrectOperationException;
-import com.siyeh.ipp.base.Intention;
+import com.intellij.psi.PsiType;
import com.siyeh.ipp.base.PsiElementPredicate;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
-import java.math.BigInteger;
+public class ConvertIntegerToHexIntention extends ConvertNumberIntentionBase {
+ @Override
+ @NotNull
+ public PsiElementPredicate getElementPredicate() {
+ return new ConvertIntegerToHexPredicate();
+ }
-public class ConvertIntegerToHexIntention extends Intention {
-
- private static final BigInteger LONG_BINARY_ONES =
- new BigInteger("ffffffffffffffff", 16);
- private static final BigInteger INT_BINARY_ONES =
- new BigInteger("ffffffff", 16);
-
- @Override @NotNull
- public PsiElementPredicate getElementPredicate() {
- return new ConvertIntegerToHexPredicate();
+ @Override
+ protected String convertValue(final Number value, final PsiType type, final boolean negated) {
+ if (PsiType.INT.equals(type)) {
+ final int intValue = negated ? -value.intValue() : value.intValue();
+ return "0x" + Integer.toHexString(intValue);
+ }
+ else if (PsiType.LONG.equals(type)) {
+ final long longValue = negated ? -value.longValue() : value.longValue();
+ return "0x" + Long.toHexString(longValue) + "L";
+ }
+ else if (PsiType.FLOAT.equals(type)) {
+ final float floatValue = negated ? -value.floatValue() : value.floatValue();
+ return Float.toHexString(floatValue) + 'f';
+ }
+ else if (PsiType.DOUBLE.equals(type)) {
+ final double doubleValue = negated ? -value.doubleValue() : value.doubleValue();
+ return Double.toHexString(doubleValue);
}
- @Override
- public void processIntention(@NotNull PsiElement element)
- throws IncorrectOperationException {
- final PsiExpression expression = (PsiExpression)element;
- final PsiType type = expression.getType();
- if (PsiType.INT.equals(type) || PsiType.LONG.equals(type)) {
- String textString = expression.getText();
- final int textLength = textString.length();
- final char lastChar = textString.charAt(textLength - 1);
- final boolean isLong = lastChar == 'l' || lastChar == 'L';
- if (isLong) {
- textString = textString.substring(0, textLength - 1);
- }
- BigInteger value;
- if (textString.charAt(0) == '0') {
- value = new BigInteger(textString, 8);
- } else {
- value = new BigInteger(textString, 10);
- final PsiElement parent = expression.getParent();
- if (parent instanceof PsiPrefixExpression) {
- final PsiPrefixExpression prefixExpression =
- (PsiPrefixExpression)parent;
- final IElementType tokenType =
- prefixExpression.getOperationTokenType();
- if (JavaTokenType.MINUS == tokenType) {
- if (isLong) {
- value = value.xor(LONG_BINARY_ONES).add(BigInteger.ONE);
- } else {
- value = value.xor(INT_BINARY_ONES).add(BigInteger.ONE);
- }
- @NonNls String hexString = "0x" + value.toString(16);
- if (isLong) {
- hexString += 'L';
- }
- replaceExpression(hexString, prefixExpression);
- return;
- }
- }
- }
- @NonNls String hexString = "0x" + value.toString(16);
- if (isLong) {
- hexString += 'L';
- }
- replaceExpression(hexString, expression);
- } else {
- String textString = expression.getText();
- final int textLength = textString.length();
- final char lastChar = textString.charAt(textLength - 1);
- final boolean isFloat = lastChar == 'f' || lastChar == 'F';
- if (isFloat) {
- textString = textString.substring(0, textLength - 1);
- }
- if (isFloat) {
- final float floatValue = Float.parseFloat(textString);
- final String floatString =
- Float.toHexString(floatValue) + lastChar;
- replaceExpression(floatString, expression);
- } else {
- final double doubleValue = Double.parseDouble(textString);
- final String floatString = Double.toHexString(doubleValue);
- replaceExpression(floatString, expression);
- }
- }
- }
+ return null;
+ }
}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalIntention.java
index 8d6b9832939d..3fe49da952bc 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalIntention.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalIntention.java
@@ -15,73 +15,28 @@
*/
package com.siyeh.ipp.integer;
-import com.intellij.psi.JavaTokenType;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiExpression;
-import com.intellij.psi.PsiPrefixExpression;
-import com.intellij.psi.tree.IElementType;
-import com.intellij.util.IncorrectOperationException;
-import com.siyeh.ipp.base.Intention;
+import com.intellij.psi.PsiType;
import com.siyeh.ipp.base.PsiElementPredicate;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
-import java.math.BigInteger;
+public class ConvertIntegerToOctalIntention extends ConvertNumberIntentionBase {
+ @Override
+ @NotNull
+ public PsiElementPredicate getElementPredicate() {
+ return new ConvertIntegerToOctalPredicate();
+ }
-public class ConvertIntegerToOctalIntention extends Intention {
-
- private static final BigInteger LONG_BINARY_ONES =
- new BigInteger("ffffffffffffffff", 16);
- private static final BigInteger INT_BINARY_ONES =
- new BigInteger("ffffffff", 16);
-
- @Override @NotNull
- public PsiElementPredicate getElementPredicate() {
- return new ConvertIntegerToOctalPredicate();
+ @Override
+ protected String convertValue(final Number value, final PsiType type, final boolean negated) {
+ if (PsiType.INT.equals(type)) {
+ final int intValue = negated ? -value.intValue() : value.intValue();
+ return "0" + Integer.toOctalString(intValue);
+ }
+ else if (PsiType.LONG.equals(type)) {
+ final long longValue = negated ? -value.longValue() : value.longValue();
+ return "0" + Long.toOctalString(longValue) + "L";
}
- @Override
- public void processIntention(@NotNull PsiElement element)
- throws IncorrectOperationException {
- final PsiExpression expression = (PsiExpression)element;
- @NonNls String textString = expression.getText();
- final int textLength = textString.length();
- final char lastChar = textString.charAt(textLength - 1);
- final boolean isLong = lastChar == 'l' || lastChar == 'L';
- if (isLong) {
- textString = textString.substring(0, textLength - 1);
- }
- BigInteger value;
- if (textString.startsWith("0x")) {
- final String rawTextString = textString.substring(2);
- value = new BigInteger(rawTextString, 16);
- } else {
- value = new BigInteger(textString, 10);
- final PsiElement parent = expression.getParent();
- if (parent instanceof PsiPrefixExpression) {
- final PsiPrefixExpression prefixExpression =
- (PsiPrefixExpression)parent;
- final IElementType tokenType =
- prefixExpression.getOperationTokenType();
- if (JavaTokenType.MINUS == tokenType) {
- if (isLong) {
- value = value.xor(LONG_BINARY_ONES).add(BigInteger.ONE);
- } else {
- value = value.xor(INT_BINARY_ONES).add(BigInteger.ONE);
- }
- @NonNls String hexString = '0' + value.toString(8);
- if (isLong) {
- hexString += 'L';
- }
- replaceExpression(hexString, prefixExpression);
- return;
- }
- }
- }
- String octString = '0' + value.toString(8);
- if (isLong) {
- octString += 'L';
- }
- replaceExpression(octString, expression);
- }
+ return null;
+ }
}
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalPredicate.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalPredicate.java
index d370613b8dc9..ea49b34232c7 100644
--- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalPredicate.java
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertIntegerToOctalPredicate.java
@@ -33,15 +33,16 @@ class ConvertIntegerToOctalPredicate implements PsiElementPredicate{
return false;
}
@NonNls final String text = expression.getText();
- if(text == null || text.length() == 0){
- return false;
- }
- if(text.startsWith("0x") || text.startsWith("0X")){
+ if (text.charAt(0) != '0') {
return true;
}
- if("0".equals(text) || "0L".equals(text)){
- return false;
+ if (text.length() < 2) {
+ return true;
}
- return text.charAt(0) != '0';
+ final char c1 = text.charAt(1);
+ if (c1 != '_' && (c1 < '0' || c1 > '7')) {
+ return true;
+ }
+ return false;
}
}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertNumberIntentionBase.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertNumberIntentionBase.java
new file mode 100644
index 000000000000..7e091f1f5997
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/integer/ConvertNumberIntentionBase.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2011 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.ipp.integer;
+
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiExpression;
+import com.intellij.psi.PsiType;
+import com.intellij.util.IncorrectOperationException;
+import com.siyeh.ipp.base.Intention;
+import com.siyeh.ipp.psiutils.ExpressionUtils;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public abstract class ConvertNumberIntentionBase extends Intention {
+ @Override
+ protected void processIntention(@NotNull final PsiElement element) throws IncorrectOperationException {
+ final PsiExpression expression = (PsiExpression)element;
+ final Number value = (Number)ExpressionUtils.computeConstantExpression(expression);
+ if (value == null) return;
+ final PsiType type = expression.getType();
+ final boolean negated = ExpressionUtils.isNegated(expression);
+
+ final String resultString = convertValue(value, type, negated);
+ if (resultString == null) return;
+
+ if (negated) {
+ replaceExpression(resultString, (PsiExpression)expression.getParent());
+ }
+ else {
+ replaceExpression(resultString, expression);
+ }
+ }
+
+ @Nullable
+ protected abstract String convertValue(final Number value, final PsiType type, final boolean negated);
+}
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/after.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/after.java.template
new file mode 100644
index 000000000000..03075fc70200
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/after.java.template
@@ -0,0 +1,5 @@
+public class X {
+ void f() {
+ int i = 0b101;
+ }
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/before.java.template b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/before.java.template
new file mode 100644
index 000000000000..48bfb8cf83ff
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/before.java.template
@@ -0,0 +1,5 @@
+public class X {
+ void f() {
+ int i = 5;
+ }
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/description.html
new file mode 100644
index 000000000000..d5973d55259d
--- /dev/null
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToBinaryIntention/description.html
@@ -0,0 +1,6 @@
+
+
+This intention converts selected integer literal into binary notation
+(supported in JDK 7 or higher).
+
+
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToDecimalIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToDecimalIntention/description.html
index ac5b0aea7330..17bc43f1a883 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToDecimalIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToDecimalIntention/description.html
@@ -1,7 +1,5 @@
-This intention converts selected integer literal (written in either hex or octal notation)
-back into decimal notation.
-
+This intention converts selected integer literal into decimal notation.
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToHexIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToHexIntention/description.html
index 278c7af311e7..4f83bc46637f 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToHexIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToHexIntention/description.html
@@ -1,7 +1,5 @@
-This intention converts selected integer literal (written in either decimal or octal notation)
-into hexadecimal notation.
-
+This intention converts selected integer literal into hexadecimal notation.
diff --git a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToOctalIntention/description.html b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToOctalIntention/description.html
index d68469967b85..710468303a75 100644
--- a/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToOctalIntention/description.html
+++ b/plugins/IntentionPowerPak/src/intentionDescriptions/ConvertIntegerToOctalIntention/description.html
@@ -1,7 +1,5 @@
-This intention converts selected integer literal (written in either decimal or hexadecimal notation)
-into octal notation.
-
+This intention converts selected integer literal into octal notation.
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec1.java
new file mode 100644
index 000000000000..ddf1c160977e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0b0__1010_1011_1100_1101;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec1_after.java
new file mode 100644
index 000000000000..dc499a48ad6d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 43981;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec2.java
new file mode 100644
index 000000000000..f9928b1de840
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0b0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec2_after.java
new file mode 100644
index 000000000000..db54e896704e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToDec2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -9223372036854775807L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex1.java
new file mode 100644
index 000000000000..ddf1c160977e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0b0__1010_1011_1100_1101;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex1_after.java
new file mode 100644
index 000000000000..c8038334fda4
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0xabcd;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex2.java
new file mode 100644
index 000000000000..f9928b1de840
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0b0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex2_after.java
new file mode 100644
index 000000000000..4e882a97a8c3
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToHex2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 0x8000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct1.java
new file mode 100644
index 000000000000..ddf1c160977e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0b0__1010_1011_1100_1101;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct1_after.java
new file mode 100644
index 000000000000..78d2b43b1e1c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0125715;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct2.java
new file mode 100644
index 000000000000..f9928b1de840
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0b0111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct2_after.java
new file mode 100644
index 000000000000..17184dd35cd1
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/BinToOct2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 01000000000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin1.java
new file mode 100644
index 000000000000..b14db253382a
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 12__345;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin1_after.java
new file mode 100644
index 000000000000..8431a5a0781e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0b11000000111001;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin2.java
new file mode 100644
index 000000000000..cc860ff7de35
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -922_3372_0368_5477_5807L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin2_after.java
new file mode 100644
index 000000000000..c5aac0b95d3c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToBin2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 0b1000000000000000000000000000000000000000000000000000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex1.java
new file mode 100644
index 000000000000..b14db253382a
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 12__345;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex1_after.java
new file mode 100644
index 000000000000..d5ed6f148790
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0x3039;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex2.java
new file mode 100644
index 000000000000..cc860ff7de35
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -922_3372_0368_5477_5807L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex2_after.java
new file mode 100644
index 000000000000..4e882a97a8c3
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 0x8000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex3.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex3.java
new file mode 100644
index 000000000000..2523b5cda6dc
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex3.java
@@ -0,0 +1,3 @@
+class C {
+ float f = 1.844_696_84E1_1f;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex3_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex3_after.java
new file mode 100644
index 000000000000..69a923d9a38d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex3_after.java
@@ -0,0 +1,3 @@
+class C {
+ float f = 0x1.579ap37f;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex4.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex4.java
new file mode 100644
index 000000000000..9b100e9650e6
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex4.java
@@ -0,0 +1,3 @@
+class C {
+ double d = -1.797_693_134_862__3157E3_0_8;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex4_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex4_after.java
new file mode 100644
index 000000000000..128e7a07dbdf
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToHex4_after.java
@@ -0,0 +1,3 @@
+class C {
+ double d = -0x1.fffffffffffffp1023;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct1.java
new file mode 100644
index 000000000000..b14db253382a
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 12__345;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct1_after.java
new file mode 100644
index 000000000000..ed9787f9812f
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 030071;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct2.java
new file mode 100644
index 000000000000..cc860ff7de35
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -922_3372_0368_5477_5807L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct2_after.java
new file mode 100644
index 000000000000..17184dd35cd1
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/DecToOct2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 01000000000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin1.java
new file mode 100644
index 000000000000..0fa5c09150ff
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0xab_cd;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin1_after.java
new file mode 100644
index 000000000000..b202cb3b97e2
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0b1010101111001101;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin2.java
new file mode 100644
index 000000000000..ce8e793a858d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0x7fff_ffff_ffff_ffffL;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin2_after.java
new file mode 100644
index 000000000000..c5aac0b95d3c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToBin2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 0b1000000000000000000000000000000000000000000000000000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec1.java
new file mode 100644
index 000000000000..0fa5c09150ff
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0xab_cd;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec1_after.java
new file mode 100644
index 000000000000..dc499a48ad6d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 43981;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec2.java
new file mode 100644
index 000000000000..ce8e793a858d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0x7fff_ffff_ffff_ffffL;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec2_after.java
new file mode 100644
index 000000000000..db54e896704e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -9223372036854775807L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec3.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec3.java
new file mode 100644
index 000000000000..25645b64d1cc
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec3.java
@@ -0,0 +1,3 @@
+class C {
+ float f = 0xab_cd.P2_2f;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec3_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec3_after.java
new file mode 100644
index 000000000000..07a6026db074
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec3_after.java
@@ -0,0 +1,3 @@
+class C {
+ float f = 1.84469684E11f;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec4.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec4.java
new file mode 100644
index 000000000000..74c09433d039
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec4.java
@@ -0,0 +1,3 @@
+class C {
+ double d = -0x1.ffff_ffff_ffff_fP1_023;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec4_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec4_after.java
new file mode 100644
index 000000000000..d412dcacac4c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToDec4_after.java
@@ -0,0 +1,3 @@
+class C {
+ double d = -1.7976931348623157E308;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct1.java
new file mode 100644
index 000000000000..0fa5c09150ff
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0xab_cd;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct1_after.java
new file mode 100644
index 000000000000..78d2b43b1e1c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0125715;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct2.java
new file mode 100644
index 000000000000..ce8e793a858d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0x7fff_ffff_ffff_ffffL;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct2_after.java
new file mode 100644
index 000000000000..17184dd35cd1
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/HexToOct2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 01000000000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin1.java
new file mode 100644
index 000000000000..3a3b1d58b6e0
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0_125_715;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin1_after.java
new file mode 100644
index 000000000000..b202cb3b97e2
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0b1010101111001101;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin2.java
new file mode 100644
index 000000000000..8eed705df98b
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0777777___77777_777__7777_777L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin2_after.java
new file mode 100644
index 000000000000..c5aac0b95d3c
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToBin2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 0b1000000000000000000000000000000000000000000000000000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec1.java
new file mode 100644
index 000000000000..3a3b1d58b6e0
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0_125_715;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec1_after.java
new file mode 100644
index 000000000000..dc499a48ad6d
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 43981;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec2.java
new file mode 100644
index 000000000000..8eed705df98b
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0777777___77777_777__7777_777L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec2_after.java
new file mode 100644
index 000000000000..db54e896704e
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToDec2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -9223372036854775807L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex1.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex1.java
new file mode 100644
index 000000000000..3a3b1d58b6e0
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex1.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0_125_715;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex1_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex1_after.java
new file mode 100644
index 000000000000..c8038334fda4
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex1_after.java
@@ -0,0 +1,3 @@
+class C {
+ int i = 0xabcd;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex2.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex2.java
new file mode 100644
index 000000000000..8eed705df98b
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex2.java
@@ -0,0 +1,3 @@
+class C {
+ long l = -0777777___77777_777__7777_777L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex2_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex2_after.java
new file mode 100644
index 000000000000..4e882a97a8c3
--- /dev/null
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/integer/OctToHex2_after.java
@@ -0,0 +1,3 @@
+class C {
+ long l = 0x8000000000000001L;
+}
\ No newline at end of file
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/IPPTestCase.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/IPPTestCase.java
new file mode 100644
index 000000000000..dd75a02b6159
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/IPPTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2011 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.ipp;
+
+import com.intellij.openapi.application.PluginPathManager;
+import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
+
+public abstract class IPPTestCase extends LightCodeInsightFixtureTestCase {
+ @Override
+ protected String getBasePath() {
+ return PluginPathManager.getPluginHomePathRelative("IntentionPowerPak") + "/test/com/siyeh/ipp/" + getRelativePath();
+ }
+
+ protected abstract String getRelativePath();
+
+ protected void doTest() {
+ final String testName = getTestName(false);
+ CodeInsightTestUtil.doIntentionTest(myFixture, getIntentionName(), testName + ".java", testName + "_after.java");
+ }
+
+ protected abstract String getIntentionName();
+}
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToBinaryTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToBinaryTest.java
new file mode 100644
index 000000000000..1f3b7b4cc15e
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToBinaryTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2011 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.ipp.integer;
+
+import com.siyeh.IntentionPowerPackBundle;
+import com.siyeh.ipp.IPPTestCase;
+
+public class ConvertIntegerToBinaryTest extends IPPTestCase {
+ public void testDecToBin1() { doTest(); }
+ public void testDecToBin2() { doTest(); }
+ public void testHexToBin1() { doTest(); }
+ public void testHexToBin2() { doTest(); }
+ public void testOctToBin1() { doTest(); }
+ public void testOctToBin2() { doTest(); }
+
+ @Override
+ protected String getIntentionName() {
+ return IntentionPowerPackBundle.message("convert.integer.to.binary.intention.name");
+ }
+
+ @Override
+ protected String getRelativePath() {
+ return "integer";
+ }
+}
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToDecimalTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToDecimalTest.java
new file mode 100644
index 000000000000..10405e41ac70
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToDecimalTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2000-2011 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.ipp.integer;
+
+import com.siyeh.IntentionPowerPackBundle;
+import com.siyeh.ipp.IPPTestCase;
+
+public class ConvertIntegerToDecimalTest extends IPPTestCase {
+ public void testHexToDec1() { doTest(); }
+ public void testHexToDec2() { doTest(); }
+ public void testHexToDec3() { doTest(); }
+ public void testHexToDec4() { doTest(); }
+ public void testOctToDec1() { doTest(); }
+ public void testOctToDec2() { doTest(); }
+ public void testBinToDec1() { doTest(); }
+ public void testBinToDec2() { doTest(); }
+
+ @Override
+ protected String getIntentionName() {
+ return IntentionPowerPackBundle.message("convert.integer.to.decimal.intention.name");
+ }
+
+ @Override
+ protected String getRelativePath() {
+ return "integer";
+ }
+}
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToHexTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToHexTest.java
new file mode 100644
index 000000000000..efa37c1d7f6d
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToHexTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2000-2011 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.ipp.integer;
+
+import com.siyeh.IntentionPowerPackBundle;
+import com.siyeh.ipp.IPPTestCase;
+
+public class ConvertIntegerToHexTest extends IPPTestCase {
+ public void testDecToHex1() { doTest(); }
+ public void testDecToHex2() { doTest(); }
+ public void testDecToHex3() { doTest(); }
+ public void testDecToHex4() { doTest(); }
+ public void testOctToHex1() { doTest(); }
+ public void testOctToHex2() { doTest(); }
+ public void testBinToHex1() { doTest(); }
+ public void testBinToHex2() { doTest(); }
+
+ @Override
+ protected String getIntentionName() {
+ return IntentionPowerPackBundle.message("convert.integer.to.hex.intention.name");
+ }
+
+ @Override
+ protected String getRelativePath() {
+ return "integer";
+ }
+}
diff --git a/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToOctalTest.java b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToOctalTest.java
new file mode 100644
index 000000000000..f1b3db6cb3c1
--- /dev/null
+++ b/plugins/IntentionPowerPak/testSrc/com/siyeh/ipp/integer/ConvertIntegerToOctalTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2011 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.ipp.integer;
+
+import com.siyeh.IntentionPowerPackBundle;
+import com.siyeh.ipp.IPPTestCase;
+
+public class ConvertIntegerToOctalTest extends IPPTestCase {
+ public void testDecToOct1() { doTest(); }
+ public void testDecToOct2() { doTest(); }
+ public void testHexToOct1() { doTest(); }
+ public void testHexToOct2() { doTest(); }
+ public void testBinToOct1() { doTest(); }
+ public void testBinToOct2() { doTest(); }
+
+ @Override
+ protected String getIntentionName() {
+ return IntentionPowerPackBundle.message("convert.integer.to.octal.intention.name");
+ }
+
+ @Override
+ protected String getRelativePath() {
+ return "integer";
+ }
+}