Skip to content

Commit

Permalink
Remove unnecessary casts
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbollinger committed Jun 17, 2014
1 parent 4513b3f commit c7c9be3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Expand Up @@ -152,7 +152,6 @@ public static JSONObject createGetDeclarationsFromPrefix(Database db,String pref
return o;
}

@SuppressWarnings("unchecked")
public static Packaged<Declaration>[] responseGetDeclarations(
String response) throws Exception {
JSONArray jDecls = new JSONArray(response);
Expand All @@ -165,11 +164,11 @@ public static Packaged<Declaration>[] responseGetDeclarations(
aDecls.add(new Packaged<Declaration>(id, decl));
}

Packaged<Declaration>[] elts = (Packaged<Declaration>[]) new Packaged[aDecls.size()];
@SuppressWarnings("unchecked")
Packaged<Declaration>[] elts = new Packaged[aDecls.size()];
return aDecls.toArray(elts);
}

@SuppressWarnings("unchecked")
public static Packaged<Declaration>[] responseGetDeclarationsFromPrefix(
String response) throws Exception {
JSONArray jDecls = new JSONArray(response);
Expand All @@ -184,7 +183,8 @@ public static Packaged<Declaration>[] responseGetDeclarationsFromPrefix(
aDecls.add(new Packaged<Declaration>(id, decl));
}

Packaged<Declaration>[] elts = (Packaged<Declaration>[]) new Packaged[aDecls.size()];
@SuppressWarnings("unchecked")
Packaged<Declaration>[] elts = new Packaged[aDecls.size()];
return aDecls.toArray(elts);
}

Expand Down
Expand Up @@ -79,21 +79,23 @@ public Module[] getModules(Database db,String module) throws IOException, JSONEx
return new Module[0];
}

@SuppressWarnings("unchecked")
@Override
public Packaged<Declaration>[] getDeclarations(Database db,String module) throws Exception {
// Return nothing
return (Packaged<Declaration>[]) new Packaged[0];
@SuppressWarnings("unchecked")
Packaged<Declaration>[] result = new Packaged[0];
return result;
}

/* (non-Javadoc)
* @see net.sf.eclipsefp.haskell.browser.BrowserServer#getDeclarationsFromPrefix(net.sf.eclipsefp.haskell.browser.Database, java.lang.String)
*/
@SuppressWarnings("unchecked")
@Override
public Packaged<Declaration>[] getDeclarationsFromPrefix(Database db,
String prefix) throws Exception {
return (Packaged<Declaration>[]) new Packaged[0];
@SuppressWarnings("unchecked")
Packaged<Declaration>[] result = new Packaged[0];
return result;
}

@Override
Expand Down
Expand Up @@ -286,7 +286,7 @@ public IFile getIFile(IProject p){
String pl=p.getLocation().toOSString();
String loc=getFileName();
if (loc!=null && loc.startsWith(pl)){
return (IFile)p.getFile(loc.substring(pl.length()));
return p.getFile(loc.substring(pl.length()));
} else if (!new File(loc).isAbsolute()) {
return p.getFile(loc);
}
Expand Down

0 comments on commit c7c9be3

Please sign in to comment.