IDEA-119819 (Cannot suppress warnings for inspection "Unnecessary unicode escape sequence")

This commit is contained in:
Bas Leijdekkers
2014-02-19 16:06:02 +01:00
parent f1f14d5d43
commit 9781b1d429
2 changed files with 10 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -103,7 +103,7 @@ public class UnnecessaryUnicodeEscapeInspection extends BaseInspection {
return new UnnecessaryUnicodeEscapeVisitor();
}
private static class UnnecessaryUnicodeEscapeVisitor extends BaseInspectionVisitor {
private class UnnecessaryUnicodeEscapeVisitor extends BaseInspectionVisitor {
@Override
public void visitFile(PsiFile file) {
@@ -157,6 +157,10 @@ public class UnnecessaryUnicodeEscapeInspection extends BaseInspection {
charBuffer.put(d).rewind();
final CoderResult coderResult = encoder.encode(charBuffer, byteBuffer, true);
if (!coderResult.isUnmappable()) {
final PsiElement element = file.findElementAt(i);
if (element != null && isSuppressedFor(element)) {
return;
}
registerErrorAtOffset(file, i, escapeEnd - i, Character.valueOf(d));
}
}
@@ -3,4 +3,8 @@ package com.siyeh.igtest.internationalization.unnecessary_unicode_escape;
class UnnecessaryUnicodeEscape {
// <warning descr="Unicode escape sequence '\uuuuuu0061' can be replaced with 'a'">\uuuuuu0061</warning><warning descr="Unicode escape sequence '\u0062' can be replaced with 'b'">\u0062</warning>
// control char & not representable char: \u0010 \u00e4
}
@SuppressWarnings("UnnecessaryUnicodeEscape")
class Suppress {
String s = "\u0062";
}