Jawa / Говнокод #8615 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
@SuppressWarnings("unused")
// Sure it's used. By Guice. So stop complaining.
protected ColQueryProvider() {
	try {
		// Exhibit one: ye olde dependency hell.
		// We *should* be able to just use new EclipseCompiler(), but GWT complains
		// in dev mode when ECJ is in the Eclipse classpath. So it's not.
		// ECJ is still loaded by the servlet container, so this is not an issue in deployment.
		final JavaCompiler compiler = (JavaCompiler)
				Class.forName("org.eclipse.jdt.internal.compiler.tool.EclipseCompiler").newInstance();
		
		// Tweaked based on QueryEngine.DEFAULT
		final DefaultEvaluatorFactory evaluatorFactory = new DefaultEvaluatorFactory(ColQueryTemplates.DEFAULT,
				(URLClassLoader) DefaultEvaluatorFactory.class.getClassLoader(), compiler);
		
		queryEngine = new DefaultQueryEngine(evaluatorFactory);
	} catch (final ClassNotFoundException e) {
		throw new ProvisionException("Eclipse compiler cannot be loaded", e);
	} catch (final InstantiationException e) {
		throw new ProvisionException("Eclipse compiler cannot be loaded", e);
	} catch (final IllegalAccessException e) {
		throw new ProvisionException("Eclipse compiler cannot be loaded", e);
	}
}

Запостил: someone someone, (Updated )

Комментарии (0) RSS

Добавить комментарий

Переведи на "PHP", guest!

    А не использовать ли нам bbcode?


    8