diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-01-31 12:20:37 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-01-31 12:21:27 +0100 |
commit | c0cf1cc37d68d5a89c540bfac4bf4a23cb0c2eba (patch) | |
tree | 394cd64def07a264ff8fbd111ca1b825f7c00aeb /sonar-plugin-api | |
parent | 47de0ecd410920fc000151f5c528b97b28505ec9 (diff) | |
download | sonarqube-c0cf1cc37d68d5a89c540bfac4bf4a23cb0c2eba.tar.gz sonarqube-c0cf1cc37d68d5a89c540bfac4bf4a23cb0c2eba.zip |
SONAR-926 Update javadoc of File.fromIoFile
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java index 475363fe6f2..013b1236adb 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/File.java @@ -25,6 +25,8 @@ import org.sonar.api.batch.SensorContext; import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.api.utils.WildcardPattern; +import javax.annotation.CheckForNull; + import java.util.List; /** @@ -144,6 +146,7 @@ public class File extends Resource { * @deprecated since 4.2 use {@link #fromIOFile(java.io.File, Project)} */ @Deprecated + @CheckForNull public static File fromIOFile(java.io.File file, List<java.io.File> sourceDirs) { PathResolver.RelativePath relativePath = new PathResolver().relativePath(sourceDirs, file); if (relativePath != null) { @@ -153,11 +156,14 @@ public class File extends Resource { } /** - * Creates a SonarQube File from its Java IO File and a module. - * The returned SonarQube File is partially initialized. But that's enough to call for example - * {@link SensorContext#saveMeasure(Resource, org.sonar.api.measures.Measure)} when resources are already index. + * Creates a SonarQube File from an absolute Java IO File and a module. + * The returned SonarQube File can be then passed for example to + * {@link SensorContext#saveMeasure(Resource, org.sonar.api.measures.Measure)}. + * @param file absolute path to a file + * @param module * @return null if the file is not under module basedir. */ + @CheckForNull public static File fromIOFile(java.io.File file, Project module) { String relativePathFromBasedir = new PathResolver().relativePath(module.getFileSystem().getBasedir(), file); if (relativePathFromBasedir != null) { |