diff options
Diffstat (limited to 'platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolsRegistrarCore.java')
-rw-r--r-- | platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolsRegistrarCore.java | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolsRegistrarCore.java b/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolsRegistrarCore.java index 7d2ffb7ce405..eb99cc4d1594 100644 --- a/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolsRegistrarCore.java +++ b/platform/analysis-api/src/com/intellij/codeInspection/ex/InspectionToolsRegistrarCore.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -17,36 +17,17 @@ package com.intellij.codeInspection.ex; import com.intellij.openapi.diagnostic.Logger; import com.intellij.util.ArrayUtil; +import com.intellij.util.ReflectionUtil; import org.jetbrains.annotations.NotNull; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - public class InspectionToolsRegistrarCore { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.InspectionToolsRegistrarCore"); static Object instantiateTool(@NotNull Class<?> toolClass) { try { - Constructor<?> constructor = toolClass.getDeclaredConstructor(ArrayUtil.EMPTY_CLASS_ARRAY); - constructor.setAccessible(true); - return constructor.newInstance(ArrayUtil.EMPTY_OBJECT_ARRAY); - } - catch (SecurityException e) { - LOG.error(e); - } - catch (NoSuchMethodException e) { - LOG.error(e); - } - catch (InstantiationException e) { - LOG.error(e); - } - catch (IllegalAccessException e) { - LOG.error(e); - } - catch (IllegalArgumentException e) { - LOG.error(e); + return ReflectionUtil.newInstance(toolClass, ArrayUtil.EMPTY_CLASS_ARRAY); } - catch (InvocationTargetException e) { - LOG.error(e); + catch (RuntimeException e) { + LOG.error(e.getCause()); } return null; |