X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2Fscoremodels%2FFeatureDistanceModel.java;h=0aa77fa659ab596d604042ba9b5db26e74bd55e2;hb=74393b51f368cb9f58589472d432a433d9c4386d;hp=ddbaf73600e05204dc854519c81b72a93f967289;hpb=4c6cd08af580ff73cfce39bec34ae4658a4b4b34;p=jalview.git diff --git a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java index ddbaf73..0aa77fa 100644 --- a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java +++ b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java @@ -58,7 +58,7 @@ public class FeatureDistanceModel extends DistanceScoreModel FeatureDistanceModel instance; try { - instance = this.getClass().newInstance(); + instance = this.getClass().getDeclaredConstructor().newInstance(); instance.configureFromAlignmentView(view); return instance; } catch (InstantiationException | IllegalAccessException e) @@ -66,6 +66,9 @@ public class FeatureDistanceModel extends DistanceScoreModel System.err.println("Error in " + getClass().getName() + ".getInstance(): " + e.getMessage()); return null; + } catch (ReflectiveOperationException roe) + { + return null; } } @@ -124,8 +127,8 @@ public class FeatureDistanceModel extends DistanceScoreModel /* * first record feature types in this column for each sequence */ - Map> sfap = findFeatureTypesAtColumn( - seqs, cpos); + Map> sfap = findFeatureTypesAtColumn(seqs, + cpos); /* * count feature types on either i'th or j'th sequence but not both @@ -188,7 +191,7 @@ public class FeatureDistanceModel extends DistanceScoreModel protected Map> findFeatureTypesAtColumn( SeqCigar[] seqs, int columnPosition) { - Map> sfap = new HashMap>(); + Map> sfap = new HashMap<>(); for (SeqCigar seq : seqs) { int spos = seq.findPosition(columnPosition); @@ -197,9 +200,9 @@ public class FeatureDistanceModel extends DistanceScoreModel /* * position is not a gap */ - Set types = new HashSet(); + Set types = new HashSet<>(); List sfs = fr.findFeaturesAtResidue( - seq.getRefSeq(), spos); + seq.getRefSeq(), spos, spos); for (SequenceFeature sf : sfs) { types.add(sf.getType());