Skip to content

Commit

Permalink
update for JAVA9 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Jul 22, 2020
1 parent 3db821f commit 0fe1087
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,12 @@ public void setLocale(Locale locale) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

// from JDK9
//@Override
@Override
public void addModules(Iterable<String> moduleNames) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

// from JDK9
//@Override
@Override
public Boolean call() {
try {
return execute(options, compilationUnits, out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@

import org.bsc.processor.BaseAbstractProcessor;

import java.io.IOException;
import java.util.Set;

import javax.annotation.processing.*;
import javax.annotation.processing.Filer;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.annotation.processing.SupportedSourceVersion;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic.Kind;
import javax.tools.FileObject;
import javax.tools.StandardLocation;
import java.io.IOException;
import java.util.Set;

/**
*
* @author softphone
*
*
*/
//@SupportedSourceVersion(SourceVersion.RELEASE_9)
@SupportedSourceVersion(SourceVersion.RELEASE_8)
//@SupportedSourceVersion(SourceVersion.RELEASE_8)
@SupportedSourceVersion(SourceVersion.RELEASE_9)
@SupportedAnnotationTypes( "*" )
//@SupportedOptions( {"subfolder", "filepath", "templateUri"})
//@SupportedAnnotationTypes( {"javax.ws.rs.GET", "javax.ws.rs.PUT", "javax.ws.rs.POST", "javax.ws.rs.DELETE"})
Expand All @@ -39,50 +40,46 @@ public class TESTWikiProcessor extends BaseAbstractProcessor {
* @throws IOException
*/
protected FileObject getResourceFormClassPath(Filer filer, final String resource, final String packageName) throws IOException {
FileObject f = filer.getResource(StandardLocation.CLASS_PATH, packageName, resource);
final FileObject f = filer.getResource(StandardLocation.CLASS_PATH, packageName, resource);

//java.io.Reader r = f.openReader(true); // ignoreEncodingErrors
java.io.InputStream is = f.openInputStream();
try(java.io.InputStream is = f.openInputStream()) {

if( is==null ) {
warn( String.format("resource [%s] not found!", resource) );
return null;
if (is == null) {
warn("resource [%s] not found!", resource);
return null;
}
}

return f;
}

/**
*
* @param annotations
* @param roundEnv
* @return
*/
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) return false;


final java.util.Map<String,String> optionMap = processingEnv.getOptions();

System.out.println( "====> PROCESSOR RUN");
for( java.util.Map.Entry<String,String> k : optionMap.entrySet() )
System.out.printf( "\t[%s] = [%s]\n", k.getKey(), k.getValue());

info( "====> PROCESSOR RUN");
optionMap.entrySet().forEach( k -> info( "\t[%s] = [%s]", k.getKey(), k.getValue()));

for( TypeElement e : annotations ) {

for (Element re : roundEnv.getElementsAnnotatedWith(e)) {
for (Element re : roundEnv.getElementsAnnotatedWith(e)) {

if( re.getKind()==ElementKind.METHOD) {

info( String.format("[%s], Element [%s] is [%s] ", re.getEnclosingElement(), re.getKind(), re.getSimpleName()));
info( "[%s], Element [%s] is [%s]", re.getEnclosingElement(), re.getKind(), re.getSimpleName() );

}
}
}

//final Filer filer = processingEnv.getFiler();

//FileObject res = getOutputFile(filer, subfolder, filePath);

//java.io.Writer w = res.openWriter();

//w.close();

return true;
}

Expand Down

0 comments on commit 0fe1087

Please sign in to comment.