From 3b40e92a7906ffa0db4061c944b8aacda8d34429 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 5 Aug 2013 10:43:16 +0200 Subject: [PATCH] testFramework: unneeded reflection dropped --- .../fixtures/JavaTestFixtureFactory.java | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/java/testFramework/src/com/intellij/testFramework/fixtures/JavaTestFixtureFactory.java b/java/testFramework/src/com/intellij/testFramework/fixtures/JavaTestFixtureFactory.java index 5ae19176c25b..3eca4524c661 100644 --- a/java/testFramework/src/com/intellij/testFramework/fixtures/JavaTestFixtureFactory.java +++ b/java/testFramework/src/com/intellij/testFramework/fixtures/JavaTestFixtureFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,23 +15,14 @@ */ package com.intellij.testFramework.fixtures; +import com.intellij.testFramework.fixtures.impl.JavaTestFixtureFactoryImpl; import org.jetbrains.annotations.NotNull; /** * @author yole */ public abstract class JavaTestFixtureFactory { - private static final JavaTestFixtureFactory ourInstance; - - static { - try { - final Class aClass = Class.forName("com.intellij.testFramework.fixtures.impl.JavaTestFixtureFactoryImpl"); - ourInstance = (JavaTestFixtureFactory)aClass.newInstance(); - } - catch (Exception e) { - throw new RuntimeException("Can't instantiate factory", e); - } - } + private static final JavaTestFixtureFactory ourInstance = new JavaTestFixtureFactoryImpl(); public static JavaTestFixtureFactory getFixtureFactory() { return ourInstance; @@ -43,14 +34,12 @@ public abstract class JavaTestFixtureFactory { public abstract JavaCodeInsightTestFixture createCodeInsightFixture(IdeaProjectTestFixture projectFixture, TempDirTestFixture tempDirFixture); - /** - * - * @deprecated use {@link JavaTestFixtureFactory#createFixtureBuilder(String)} - */ + /** @deprecated use {@link JavaTestFixtureFactory#createFixtureBuilder(String)} */ //also implicitly initializes ourInstance and registers java module fixture builder public static TestFixtureBuilder createFixtureBuilder() { return IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(); } + public static TestFixtureBuilder createFixtureBuilder(@NotNull String name) { return IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(name); }