/** * Returns the snapshot used by java parser * @return the snapshot * @since 0.42 */ public @NonNull Snapshot getSnapshot () { checkConfinement(); return this.impl.getSnapshot(); }
/**Return {@link PositionConverter} binding virtual Java source and the real source. * Please note that this method is needed only for clients that need to work * in non-Java files (e.g. JSP files) or in dialogs, like code completion. * Most clients do not need to use {@link PositionConverter}. * * @return PositionConverter binding the virtual Java source and the real source. * @since 0.21 * @deprecated as of 0.42, this is superseded by Parsing API. */ @Deprecated public PositionConverter getPositionConverter() { checkConfinement(); if (this.impl.getFileObject() == null) { throw new IllegalStateException (); } return new PositionConverter(impl.getSnapshot()); }
public JavacParserResult (final CompilationInfo info) { super ( JavaSourceAccessor.getINSTANCE ().getCompilationInfoImpl (info).getSnapshot () ); Parameters.notNull("info", info); //NOI18N this.info = info; }
/** * Return the {@link Trees} service of the javac represented by this {@link CompilationInfo}. * @return javac Trees service */ public synchronized @NonNull Trees getTrees() { checkConfinement(); if (trees == null) { trees = JavacTrees.instance(impl.getJavacTask().getContext()); Snapshot snapshot = impl.getSnapshot(); Document doc = snapshot != null ? snapshot.getSource().getDocument(false) : null; WrapperFactory factory = doc != null ? (WrapperFactory)doc.getProperty(WrapperFactory.class) : null; if (factory != null) { trees = factory.wrapTrees(trees); } } return trees; }