src/share/sample/language/model/CoreReflectionFactory.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * --- 1,7 ---- /* ! * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *
*** 37,47 **** import javax.lang.model.util.*; import java.lang.reflect.*; import java.io.Writer; import java.util.*; ! import static javax.lang.model.SourceVersion.RELEASE_8; import static java.util.Objects.*; /** * This class provides a proof-of-concept implementation of the {@code * javax.lang.model.*} API backed by core reflection. That is, rather --- 37,47 ---- import javax.lang.model.util.*; import java.lang.reflect.*; import java.io.Writer; import java.util.*; ! import static javax.lang.model.SourceVersion.RELEASE_9; import static java.util.Objects.*; /** * This class provides a proof-of-concept implementation of the {@code * javax.lang.model.*} API backed by core reflection. That is, rather
*** 485,515 **** } /** * Base class for concrete visitors of elements backed by core reflection. */ ! public static abstract class AbstractReflectionElementVisitor8<R, P> ! extends AbstractElementVisitor8<R, P> implements ReflectionElementVisitor<R, P> { ! protected AbstractReflectionElementVisitor8() { super(); } } /** * Base class for simple visitors of elements that are backed by core reflection. */ ! @SupportedSourceVersion(value=RELEASE_8) ! public static abstract class SimpleReflectionElementVisitor8<R, P> ! extends SimpleElementVisitor8<R, P> implements ReflectionElementVisitor<R, P> { ! protected SimpleReflectionElementVisitor8(){ super(); } ! protected SimpleReflectionElementVisitor8(R defaultValue) { super(defaultValue); } // Create manual "bridge methods" for now. --- 485,515 ---- } /** * Base class for concrete visitors of elements backed by core reflection. */ ! public static abstract class AbstractReflectionElementVisitor9<R, P> ! extends AbstractElementVisitor9<R, P> implements ReflectionElementVisitor<R, P> { ! protected AbstractReflectionElementVisitor9() { super(); } } /** * Base class for simple visitors of elements that are backed by core reflection. */ ! @SupportedSourceVersion(value=RELEASE_9) ! public static abstract class SimpleReflectionElementVisitor9<R, P> ! extends SimpleElementVisitor9<R, P> implements ReflectionElementVisitor<R, P> { ! protected SimpleReflectionElementVisitor9(){ super(); } ! protected SimpleReflectionElementVisitor9(R defaultValue) { super(defaultValue); } // Create manual "bridge methods" for now.
*** 2525,2535 **** Class<?> printProcClass = ClassLoader.getSystemClassLoader().loadClass("com.sun.tools.javac.processing.PrintingProcessor$PrintingElementVisitor"); Constructor<?> printProcCtor = printProcClass.getConstructor(Writer.class, Elements.class); return (ElementVisitor) printProcCtor.newInstance(w, getElements()); } catch (ReflectiveOperationException | SecurityException e) { ! return new ElementScanner8<Writer, Void>(w){ @Override public Writer scan(Element e, Void v) { try { DEFAULT_VALUE.append(e.toString()); DEFAULT_VALUE.append("\n"); --- 2525,2535 ---- Class<?> printProcClass = ClassLoader.getSystemClassLoader().loadClass("com.sun.tools.javac.processing.PrintingProcessor$PrintingElementVisitor"); Constructor<?> printProcCtor = printProcClass.getConstructor(Writer.class, Elements.class); return (ElementVisitor) printProcCtor.newInstance(w, getElements()); } catch (ReflectiveOperationException | SecurityException e) { ! return new ElementScanner9<Writer, Void>(w){ @Override public Writer scan(Element e, Void v) { try { DEFAULT_VALUE.append(e.toString()); DEFAULT_VALUE.append("\n");