aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-04-15 10:06:08 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-04-15 10:06:39 +0200
commitfa6f273677f8d665c0dad1283883111e626be29e (patch)
tree64fd9efb6b14df9229c2c8495e0325076ed831ee /sonar-plugin-api
parentfe0764d0b64956a59eb3c10e491770182fe954ab (diff)
downloadsonarqube-fa6f273677f8d665c0dad1283883111e626be29e.tar.gz
sonarqube-fa6f273677f8d665c0dad1283883111e626be29e.zip
SONAR-1865 Dollars ($) are not accepted in java class names
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java6
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java13
2 files changed, 5 insertions, 14 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
index 1949efea86c..9b68e000f24 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/JavaFile.java
@@ -54,9 +54,6 @@ public class JavaFile extends Resource<JavaPackage> {
if (className == null) {
throw new IllegalArgumentException("Java filename can not be null");
}
- if (className.indexOf('$') >= 0) {
- throw new IllegalArgumentException("Java inner classes are not supported : " + className);
- }
this.filename = StringUtils.trim(className);
String key;
if (StringUtils.isBlank(packageKey)) {
@@ -88,9 +85,6 @@ public class JavaFile extends Resource<JavaPackage> {
if (key == null) {
throw new IllegalArgumentException("Java filename can not be null");
}
- if (key.indexOf('$') >= 0) {
- throw new IllegalArgumentException("Java inner classes are not supported : " + key);
- }
String realKey = StringUtils.trim(key);
this.unitTest = unitTest;
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
index 33b597c7f68..4605b640017 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/resources/JavaFileTest.java
@@ -55,14 +55,11 @@ public class JavaFileTest {
assertThat(javaClass.getParent().getKey(), is("org.foo.bar"));
}
- @Test(expected = IllegalArgumentException.class)
- public void doNotAcceptInnerClasses() {
- new JavaFile("org.foo.bar", "Hello$Bar");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void doNotAcceptInnerClasses2() {
- new JavaFile("org.foo.bar.Hello$Bar");
+ @Test
+ public void shouldAcceptFilenamesWithDollars() {
+ // $ is not used only for inner classes !!!
+ JavaFile javaFile = new JavaFile("org.foo.bar", "Hello$Bar");
+ assertThat(javaFile.getKey(), is("org.foo.bar.Hello$Bar"));
}
@Test