Remove unreachable catchblock.

And enable save actions so imports are autoorganized.

Change-Id: I2e0b7167112b1ada31c7e782aeee65c9068707a3
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/plugins/org.eclipse.dltk.ruby.core/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.dltk.ruby.core/.settings/org.eclipse.jdt.ui.prefs
index 59273f6..2be769c 100644
--- a/plugins/org.eclipse.dltk.ruby.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.dltk.ruby.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,61 @@
-#Thu Oct 21 16:34:15 CEST 2010
 eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
 formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
 formatter_settings_version=11
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/typehierarchy/RubyTypeHierarchyEngine.java b/plugins/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/typehierarchy/RubyTypeHierarchyEngine.java
index fde96ea..18fbbc1 100644
--- a/plugins/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/typehierarchy/RubyTypeHierarchyEngine.java
+++ b/plugins/org.eclipse.dltk.ruby.core/src/org/eclipse/dltk/ruby/internal/typehierarchy/RubyTypeHierarchyEngine.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -11,7 +11,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.dltk.core.DLTKLanguageManager;
 import org.eclipse.dltk.core.IType;
@@ -26,21 +25,29 @@
 
 public class RubyTypeHierarchyEngine {
 	private static final boolean DEBUG = false;
-	public static IType[] locateSuperTypes( IType type, IProgressMonitor monitor ) {
+
+	public static IType[] locateSuperTypes(IType type,
+			IProgressMonitor monitor) {
 		try {
 			String[] superTypes = type.getSuperClasses();
-			List<IType> types = new ArrayList<IType>();
+			List<IType> types = new ArrayList<>();
 			if (superTypes != null) {
-				monitor.beginTask(Messages.RubyTypeHierarchyEngine_collectingTypes, superTypes.length);
-				IDLTKSearchScope scope = SearchEngine.createWorkspaceScope(DLTKLanguageManager.getLanguageToolkit(type));
-				for( int i = 0; i < superTypes.length; ++i ) {
-					if( DEBUG ) {
-						System.out.println("Type:" + type.getElementName() + " has supertype:" + superTypes[i]); //$NON-NLS-1$ //$NON-NLS-2$
+				monitor.beginTask(
+						Messages.RubyTypeHierarchyEngine_collectingTypes,
+						superTypes.length);
+				IDLTKSearchScope scope = SearchEngine.createWorkspaceScope(
+						DLTKLanguageManager.getLanguageToolkit(type));
+				for (int i = 0; i < superTypes.length; ++i) {
+					if (DEBUG) {
+						System.out.println("Type:" + type.getElementName() //$NON-NLS-1$
+								+ " has supertype:" + superTypes[i]); //$NON-NLS-1$
 					}
-					TypeNameMatch[] possibleTypes = searchTypesForName(superTypes[i], monitor, scope);
-					for( int j = 0; j < possibleTypes.length; ++i ) {
+					TypeNameMatch[] possibleTypes = searchTypesForName(
+							superTypes[i], monitor, scope);
+					for (int j = 0; j < possibleTypes.length; ++i) {
 						IType sType = possibleTypes[j].getType();
-						if( sType.exists() && filterTypeFromSelection(sType, type)) {
+						if (sType.exists()
+								&& filterTypeFromSelection(sType, type)) {
 							types.add(sType);
 						}
 					}
@@ -49,52 +56,51 @@
 			return types.toArray(new IType[types.size()]);
 		} catch (ModelException e) {
 			e.printStackTrace();
-		} catch (CoreException e) {
-			e.printStackTrace();
-		}
-		finally {
+		} finally {
 			monitor.done();
 		}
 		return null;
 	}
-	private static boolean filterTypeFromSelection(IType superType, IType type ) {
+
+	private static boolean filterTypeFromSelection(IType superType,
+			IType type) {
 		return true;
 	}
-	private static TypeNameMatch[] searchTypesForName(String name, IProgressMonitor monitor, IDLTKSearchScope scope ) {
+
+	private static TypeNameMatch[] searchTypesForName(String name,
+			IProgressMonitor monitor, IDLTKSearchScope scope) {
 		SearchRequestor reqestor = new SearchRequestor();
-		SearchEngine engine= new SearchEngine((WorkingCopyOwner)null);
+		SearchEngine engine = new SearchEngine((WorkingCopyOwner) null);
 		monitor.setTaskName(Messages.RubyTypeHierarchyEngine_searchingTypes);
 		try {
-			engine.searchAllTypeNames(
-				null, 
-				0,
-				name.toCharArray(), 
-				SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, 
-				IDLTKSearchConstants.TYPE, 
-				scope, 
-				reqestor, 
-				IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, 
-				monitor);
+			engine.searchAllTypeNames(null, 0, name.toCharArray(),
+					SearchPattern.R_EXACT_MATCH
+							| SearchPattern.R_CASE_SENSITIVE,
+					IDLTKSearchConstants.TYPE, scope, reqestor,
+					IDLTKSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor);
 			return reqestor.getResult();
 		} catch (ModelException e) {
 			e.printStackTrace();
 		}
 		return null;
 	}
+
 	private static class SearchRequestor extends TypeNameMatchRequestor {
 		private volatile boolean fStop;
 
 		private List<TypeNameMatch> fResult;
-		
+
 		public SearchRequestor() {
 			super();
-			fResult= new ArrayList<TypeNameMatch>(5);
+			fResult = new ArrayList<>(5);
 		}
+
 		public TypeNameMatch[] getResult() {
 			return fResult.toArray(new TypeNameMatch[fResult.size()]);
 		}
+
 		public void cancel() {
-			fStop= true;
+			fStop = true;
 		}
 
 		@Override