Skip to content

Commit c91505c

Browse files
Bananeweizenromani
authored andcommitted
minor: fix several deprecations
1 parent 45842d4 commit c91505c

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/config/meta/MetadataFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public static RuleMetadata createGenericMetadata(Module module) {
389389
Class<?> checkClass = CheckstylePlugin.getDefault().getAddonExtensionClassLoader()
390390
.loadClass(module.getName());
391391

392-
Object moduleInstance = checkClass.newInstance();
392+
Object moduleInstance = checkClass.getDeclaredConstructor().newInstance();
393393

394394
if (moduleInstance instanceof AbstractFileSetCheck) {
395395
parent = XMLTags.CHECKER_MODULE;
@@ -841,7 +841,7 @@ private static void processProperties(Element moduleElement, RuleMetadata module
841841

842842
if (IOptionProvider.class.isAssignableFrom(providerClass)) {
843843

844-
IOptionProvider provider = (IOptionProvider) providerClass.newInstance();
844+
IOptionProvider provider = (IOptionProvider) providerClass.getDeclaredConstructor().newInstance();
845845
property.getPropertyEnumeration().addAll(provider.getOptions());
846846
} else if (Enum.class.isAssignableFrom(providerClass)) {
847847

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/transformer/CheckstyleTransformer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ private void loadTransformationClasses(final List<String> classnames)
9999
try {
100100
transformationClass = CheckstylePlugin.getDefault().getAddonExtensionClassLoader()
101101
.loadClass(name);
102-
final CTransformationClass transObj = (CTransformationClass) transformationClass
102+
final CTransformationClass transObj = (CTransformationClass) transformationClass.getDeclaredConstructor()
103103
.newInstance();
104104
transObj.setRule(rule);
105105
mTransformationClasses.add(transObj);
106106
// Logger.writeln("using " + name + " to transform rule \""
107107
// + rule.getName() + "\"");
108108
} catch (final ClassNotFoundException e) {
109109
// NOOP there is just no appropriate transformer class
110-
} catch (final InstantiationException | IllegalAccessException e) {
110+
} catch (final ReflectiveOperationException e) {
111111
CheckstylePluginException.rethrow(e);
112112
}
113113
}

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/transformer/FormatterTransformer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private void loadTransformationClasses(final List<String> classnames)
9797
transformationClass = CheckstylePlugin.getDefault().getAddonExtensionClassLoader()
9898
.loadClass(name);
9999

100-
final FTransformationClass transObj = (FTransformationClass) transformationClass
100+
final FTransformationClass transObj = (FTransformationClass) transformationClass.getDeclaredConstructor()
101101
.newInstance();
102102

103103
transObj.setValue(mFormatterSetting.getFormatterSettings().get(rule));
@@ -106,7 +106,7 @@ private void loadTransformationClasses(final List<String> classnames)
106106

107107
} catch (final ClassNotFoundException e) {
108108
// NOOP no appropriate transformer class present
109-
} catch (final InstantiationException | IllegalAccessException e) {
109+
} catch (final ReflectiveOperationException e) {
110110
CheckstylePluginException.rethrow(e);
111111
}
112112
}

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/CheckstyleUIPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.eclipse.ui.IWorkbenchPage;
4444
import org.eclipse.ui.IWorkbenchPartReference;
4545
import org.eclipse.ui.IWorkbenchWindow;
46+
import org.eclipse.ui.PlatformUI;
4647
import org.eclipse.ui.plugin.AbstractUIPlugin;
4748
import org.osgi.framework.BundleContext;
4849

@@ -81,7 +82,7 @@ public void start(BundleContext context) throws Exception {
8182
QUICKFIX_PROVIDER_EXT_PT_ID);
8283

8384
// add listeners for the Check-On-Open support
84-
final IWorkbench workbench = getWorkbench();
85+
final IWorkbench workbench = PlatformUI.getWorkbench();
8586
workbench.getDisplay().asyncExec(new Runnable() {
8687
@Override
8788
public void run() {

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/config/configtypes/ConfigurationTypesUI.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
/**
4040
* Register for the configuration types ui thats use the
4141
* <i>net.sf.eclipsecs.ui.configtypesui </i> extension point.
42-
*
42+
*
4343
* @author Lars Ködderitzsch
4444
*/
4545
public final class ConfigurationTypesUI {
@@ -106,7 +106,7 @@ private ConfigurationTypesUI() {
106106

107107
/**
108108
* Creates the editor for a given configuration type.
109-
*
109+
*
110110
* @param configType
111111
* the configuration type
112112
* @return the editor
@@ -122,9 +122,9 @@ public static ICheckConfigurationEditor getNewEditor(IConfigurationType configTy
122122
if (editorClass != null) {
123123

124124
try {
125-
ICheckConfigurationEditor editor = editorClass.newInstance();
125+
ICheckConfigurationEditor editor = editorClass.getDeclaredConstructor().newInstance();
126126
return editor;
127-
} catch (InstantiationException | IllegalAccessException | ClassCastException e) {
127+
} catch (ClassCastException | ReflectiveOperationException e) {
128128
CheckstylePluginException.rethrow(e);
129129
}
130130
}
@@ -134,7 +134,7 @@ public static ICheckConfigurationEditor getNewEditor(IConfigurationType configTy
134134

135135
/**
136136
* Return an image for the given configuration type.
137-
*
137+
*
138138
* @param configType
139139
* the configuration type
140140
* @return the image representing the configuration type or <code>null</code>

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/properties/filter/PluginFilterEditors.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/**
3535
* Register for the filter editors thats use the
3636
* <i>net.sf.eclipsecs.ui.filtereditors </i> extension point.
37-
*
37+
*
3838
* @author Lars Ködderitzsch
3939
*/
4040
public final class PluginFilterEditors {
@@ -84,7 +84,7 @@ private PluginFilterEditors() {
8484

8585
/**
8686
* Determines if a given filter has an editor.
87-
*
87+
*
8888
* @param filter
8989
* the filter
9090
* @return <code>true</code> if the filter has an editor, <code>false</code>
@@ -96,7 +96,7 @@ public static boolean hasEditor(IFilter filter) {
9696

9797
/**
9898
* Creates the filter editor for a given filter.
99-
*
99+
*
100100
* @param filter
101101
* the filter
102102
* @return the filter editor
@@ -110,9 +110,9 @@ public static IFilterEditor getNewEditor(IFilter filter) throws CheckstylePlugin
110110
if (editorClass != null) {
111111

112112
try {
113-
IFilterEditor editor = editorClass.newInstance();
113+
IFilterEditor editor = editorClass.getDeclaredConstructor().newInstance();
114114
return editor;
115-
} catch (InstantiationException | IllegalAccessException | ClassCastException e) {
115+
} catch (ClassCastException | ReflectiveOperationException | SecurityException e) {
116116
CheckstylePluginException.rethrow(e);
117117
}
118118
}

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/quickfixes/CheckstyleMarkerResolutionGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
/**
3838
* Profides marker resolutions (quickfixes) for Checkstyle markers.
39-
*
39+
*
4040
* @author Lars Ködderitzsch
4141
*/
4242
public class CheckstyleMarkerResolutionGenerator implements IMarkerResolutionGenerator2 {
@@ -104,11 +104,11 @@ private List<ICheckstyleMarkerResolution> getInstantiatedQuickfixes(RuleMetadata
104104
Class<?> quickfixClass = CheckstyleUIPlugin.getDefault().getQuickfixExtensionClassLoader()
105105
.loadClass(quickfixClassName);
106106

107-
ICheckstyleMarkerResolution fix = (ICheckstyleMarkerResolution) quickfixClass.newInstance();
107+
ICheckstyleMarkerResolution fix = (ICheckstyleMarkerResolution) quickfixClass.getDeclaredConstructor().newInstance();
108108
fix.setRuleMetaData(ruleMetadata);
109109
fixes.add(fix);
110110
}
111-
} catch (InstantiationException | ClassNotFoundException | IllegalAccessException e) {
111+
} catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
112112
CheckstyleLog.log(e);
113113
}
114114
return fixes;

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/stats/views/internal/CheckstyleMarkerFilter.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import java.util.List;
2929

3030
import net.sf.eclipsecs.core.builder.CheckstyleMarker;
31-
import net.sf.eclipsecs.ui.CheckstyleUIPlugin;
32-
3331
import org.eclipse.core.resources.IMarker;
3432
import org.eclipse.core.resources.IProject;
3533
import org.eclipse.core.resources.IResource;
@@ -39,6 +37,7 @@
3937
import org.eclipse.core.runtime.IProgressMonitor;
4038
import org.eclipse.jface.dialogs.IDialogSettings;
4139
import org.eclipse.ui.IWorkingSet;
40+
import org.eclipse.ui.PlatformUI;
4241

4342
/**
4443
* Filter class for Checkstyle markers. This filter is used by the Checkstyle statistics views.
@@ -380,7 +379,7 @@ public void restoreState(IDialogSettings dialogSettings) {
380379

381380
setting = settings.get(TAG_WORKING_SET);
382381
if (setting != null) {
383-
setWorkingSet(CheckstyleUIPlugin.getDefault().getWorkbench().getWorkingSetManager()
382+
setWorkingSet(PlatformUI.getWorkbench().getWorkingSetManager()
384383
.getWorkingSet(setting));
385384
}
386385

0 commit comments

Comments
 (0)