@@ -188,27 +188,7 @@ public Stream(MethodInvocation streamCreation) throws ClassHierarchyException, I
188
188
this .orderingInference = new OrderingInference (this .getClassHierarchy ());
189
189
190
190
this .inferInitialExecution ();
191
-
192
- try {
193
- this .inferInitialOrdering ();
194
- } catch (InconsistentPossibleOrderingException e ) {
195
- LOGGER .log (Level .WARNING , "Exception caught while processing: " + streamCreation , e );
196
- addStatusEntry (PreconditionFailure .INCONSISTENT_POSSIBLE_STREAM_SOURCE_ORDERING ,
197
- "Stream: " + streamCreation + " has inconsistent possible source orderings." );
198
- } catch (NoniterableException e ) {
199
- LOGGER .log (Level .WARNING , "Exception caught while processing: " + streamCreation , e );
200
- addStatusEntry (PreconditionFailure .NON_ITERABLE_POSSIBLE_STREAM_SOURCE ,
201
- "Stream: " + streamCreation + " has a non-iterable possible source." );
202
- } catch (NoninstantiableException e ) {
203
- LOGGER .log (Level .WARNING , "Exception caught while processing: " + streamCreation , e );
204
- addStatusEntry (PreconditionFailure .NON_INSTANTIABLE_POSSIBLE_STREAM_SOURCE , "Stream: " + streamCreation
205
- + " has a non-instantiable possible source with type: " + e .getSourceType () + "." );
206
- } catch (CannotExtractSpliteratorException e ) {
207
- LOGGER .log (Level .WARNING , "Exception caught while processing: " + streamCreation , e );
208
- addStatusEntry (PreconditionFailure .NON_DETERMINABLE_STREAM_SOURCE_ORDERING ,
209
- "Cannot extract spliterator from type: " + e .getFromType () + " for stream: " + streamCreation
210
- + "." );
211
- }
191
+ this .inferInitialOrdering ();
212
192
213
193
try {
214
194
// start the state machine.
@@ -572,10 +552,8 @@ private void inferInitialExecution() {
572
552
this .setInitialExecutionMode (ExecutionMode .SEQUENTIAL );
573
553
}
574
554
575
- private void inferInitialOrdering ()
576
- throws IOException , CoreException , ClassHierarchyException , InvalidClassFileException ,
577
- InconsistentPossibleOrderingException , NoniterableException , NoninstantiableException ,
578
- CannotExtractSpliteratorException , CallGraphBuilderCancelException , CancelException {
555
+ private void inferInitialOrdering () throws IOException , CoreException , ClassHierarchyException ,
556
+ InvalidClassFileException , CallGraphBuilderCancelException , CancelException {
579
557
ITypeBinding expressionTypeBinding = this .getCreation ().getExpression ().resolveTypeBinding ();
580
558
String expressionTypeQualifiedName = expressionTypeBinding .getErasure ().getQualifiedName ();
581
559
IMethodBinding calledMethodBinding = this .getCreation ().resolveMethodBinding ();
@@ -609,14 +587,37 @@ private void inferInitialOrdering()
609
587
return ;
610
588
}
611
589
612
- Collection <TypeAbstraction > possibleTypes = getPossibleTypesInterprocedurally (node , valueNumber ,
613
- this .getAnalysisEngine ().getHeapGraph ().getHeapModel (),
614
- this .getAnalysisEngine ().getPointerAnalysis (), this , LOGGER );
590
+ Collection <TypeAbstraction > possibleTypes = null ;
591
+ IMethod calledMethod = null ;
592
+ Ordering ordering = null ;
593
+ try {
594
+ possibleTypes = getPossibleTypesInterprocedurally (node , valueNumber ,
595
+ this .getAnalysisEngine ().getHeapGraph ().getHeapModel (),
596
+ this .getAnalysisEngine ().getPointerAnalysis (), this , LOGGER );
615
597
616
- // Possible types: check each one.
617
- IMethod calledMethod = (IMethod ) calledMethodBinding .getJavaElement ();
598
+ // Possible types: check each one.
599
+ calledMethod = (IMethod ) calledMethodBinding .getJavaElement ();
618
600
619
- Ordering ordering = this .getOrderingInference ().inferOrdering (possibleTypes , calledMethod );
601
+ ordering = this .getOrderingInference ().inferOrdering (possibleTypes , calledMethod );
602
+ } catch (NoniterableException e ) {
603
+ LOGGER .log (Level .WARNING , "Stream: " + this .getCreation ()
604
+ + " has a non-iterable possible source. Falling back to: " + Ordering .ORDERED + "." , e );
605
+ ordering = Ordering .ORDERED ;
606
+ } catch (NoninstantiableException e ) {
607
+ LOGGER .log (Level .WARNING ,
608
+ "Stream: " + this .getCreation () + " has a non-instantiable possible source with type: "
609
+ + e .getSourceType () + ". Falling back to: " + Ordering .ORDERED + "." ,
610
+ e );
611
+ ordering = Ordering .ORDERED ;
612
+ } catch (CannotExtractSpliteratorException e ) {
613
+ LOGGER .log (Level .WARNING , "Cannot extract spliterator from type: " + e .getFromType () + " for stream: "
614
+ + this .getCreation () + ". Falling back to: " + Ordering .ORDERED + "." , e );
615
+ ordering = Ordering .ORDERED ;
616
+ } catch (InconsistentPossibleOrderingException e ) {
617
+ LOGGER .log (Level .WARNING , "Stream: " + this .getCreation ()
618
+ + " has inconsistent possible source orderings. Falling back to: " + Ordering .ORDERED + "." , e );
619
+ ordering = Ordering .ORDERED ;
620
+ }
620
621
621
622
if (ordering == null ) {
622
623
ordering = Ordering .ORDERED ;
@@ -789,7 +790,7 @@ protected void buildCallGraph() throws IOException, CoreException, CallGraphBuil
789
790
// methods
790
791
// and use those as entry points.
791
792
try {
792
- getAnalysisEngine ().buildSafeCallGraph (options );
793
+ getAnalysisEngine ().buildSafeCallGraph (options );
793
794
} catch (IllegalStateException e ) {
794
795
LOGGER .log (Level .SEVERE , e , () -> "Exception encountered while building call graph for Stream: " + this
795
796
+ " in project: " + this .getCreationJavaProject ());
0 commit comments