Skip to content

Instantly share code, notes, and snippets.

@KengoTODA
Created August 10, 2020 12:13
Show Gist options
  • Save KengoTODA/8011f3860ee3d66397b9b0e247ba82c4 to your computer and use it in GitHub Desktop.
Save KengoTODA/8011f3860ee3d66397b9b0e247ba82c4 to your computer and use it in GitHub Desktop.
digraph Issue493 {
subgraph cluster_method_1 {
label="#method";
graph[style=dotted];
edge1_0 [label="ALOAD (1)"];
edge1_1 [label="javax/sql/DataSource#getConnection()Ljava/sql/Connection;"];
edge1_2 [label="ASTORE (2)"];
edge1_3 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_4 [label="java/lang/System#out (Ljava/io/PrintStream;)"];
edge1_5 [label="java/io/PrintStream#println()V"];
edge1_6 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_7 [label="ALOAD (2)"];
edge1_8 [label="class org.objectweb.asm.tree.JumpInsnNode"];
edge1_9 [label="ALOAD (2)"];
edge1_10 [label="java/sql/Connection#close()V"];
edge1_11 [label="class org.objectweb.asm.tree.JumpInsnNode"];
edge1_12 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_13 [label="class org.objectweb.asm.tree.FrameNode"];
edge1_14 [label="ASTORE (3)"];
edge1_15 [label="ALOAD (2)"];
edge1_16 [label="class org.objectweb.asm.tree.JumpInsnNode"];
edge1_17 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_18 [label="ALOAD (2)"];
edge1_19 [label="java/sql/Connection#close()V"];
edge1_20 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_21 [label="class org.objectweb.asm.tree.JumpInsnNode"];
edge1_22 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_23 [label="class org.objectweb.asm.tree.FrameNode"];
edge1_24 [label="ASTORE (4)"];
edge1_25 [label="ALOAD (3)"];
edge1_26 [label="ALOAD (4)"];
edge1_27 [label="java/lang/Throwable#addSuppressed(Ljava/lang/Throwable;)V"];
edge1_28 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_29 [label="class org.objectweb.asm.tree.FrameNode"];
edge1_30 [label="ALOAD (3)"];
edge1_31 [label="ATHROW"];
edge1_32 [label="class org.objectweb.asm.tree.LabelNode"];
edge1_33 [label="class org.objectweb.asm.tree.FrameNode"];
edge1_34 [label="RETURN"];
edge1_0 -> edge1_1;
edge1_1 -> edge1_2;
edge1_2 -> edge1_3;
edge1_3 -> edge1_4;
edge1_3 -> edge1_12 [color = "red"];
edge1_12 -> edge1_13;
edge1_13 -> edge1_14;
edge1_14 -> edge1_15;
edge1_15 -> edge1_16;
edge1_16 -> edge1_17 [label=""];
edge1_16 -> edge1_28 [label="if null"];
edge1_28 -> edge1_29;
edge1_29 -> edge1_30;
edge1_30 -> edge1_31;
edge1_17 -> edge1_18;
edge1_17 -> edge1_22 [color = "red"];
edge1_22 -> edge1_23;
edge1_23 -> edge1_24;
edge1_24 -> edge1_25;
edge1_25 -> edge1_26;
edge1_26 -> edge1_27;
edge1_27 -> edge1_28;
edge1_18 -> edge1_19;
edge1_18 -> edge1_22 [color = "red"];
edge1_19 -> edge1_20;
edge1_19 -> edge1_22 [color = "red"];
edge1_20 -> edge1_21;
edge1_21 -> edge1_28 [label=""];
edge1_4 -> edge1_5;
edge1_4 -> edge1_12 [color = "red"];
edge1_5 -> edge1_6;
edge1_5 -> edge1_12 [color = "red"];
edge1_6 -> edge1_7;
edge1_7 -> edge1_8;
edge1_8 -> edge1_9 [label=""];
edge1_8 -> edge1_32 [label="if null"];
edge1_32 -> edge1_33;
edge1_33 -> edge1_34;
edge1_9 -> edge1_10;
edge1_10 -> edge1_11;
edge1_11 -> edge1_32 [label=""];
}
}
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
/**
* @see <a href="https://github.com/spotbugs/spotbugs/issues/493">GitHub issue</a>
*/
abstract class Issue493 {
void method(DataSource ds) throws SQLException {
try (Connection cnn = ds.getConnection()) {
System.out.println();
}
}
}
Classfile /Users/kengo/GitHub/spotbugs/spotbugsTestCases/build/classes/java/main/Issue493.class
Last modified Aug 10, 2020; size 930 bytes
MD5 checksum da50bae641cd1cfc35731217e8f0ef55
Compiled from "Issue493.java"
abstract class Issue493
minor version: 0
major version: 52
flags: (0x0420) ACC_SUPER, ACC_ABSTRACT
this_class: #8 // Issue493
super_class: #9 // java/lang/Object
interfaces: 0, fields: 0, methods: 2, attributes: 1
Constant pool:
#1 = Methodref #9.#30 // java/lang/Object."<init>":()V
#2 = InterfaceMethodref #24.#31 // javax/sql/DataSource.getConnection:()Ljava/sql/Connection;
#3 = Fieldref #32.#33 // java/lang/System.out:Ljava/io/PrintStream;
#4 = Methodref #34.#35 // java/io/PrintStream.println:()V
#5 = InterfaceMethodref #25.#36 // java/sql/Connection.close:()V
#6 = Class #37 // java/lang/Throwable
#7 = Methodref #6.#38 // java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V
#8 = Class #39 // Issue493
#9 = Class #40 // java/lang/Object
#10 = Utf8 <init>
#11 = Utf8 ()V
#12 = Utf8 Code
#13 = Utf8 LineNumberTable
#14 = Utf8 LocalVariableTable
#15 = Utf8 this
#16 = Utf8 LIssue493;
#17 = Utf8 method
#18 = Utf8 (Ljavax/sql/DataSource;)V
#19 = Utf8 cnn
#20 = Utf8 Ljava/sql/Connection;
#21 = Utf8 ds
#22 = Utf8 Ljavax/sql/DataSource;
#23 = Utf8 StackMapTable
#24 = Class #41 // javax/sql/DataSource
#25 = Class #42 // java/sql/Connection
#26 = Utf8 Exceptions
#27 = Class #43 // java/sql/SQLException
#28 = Utf8 SourceFile
#29 = Utf8 Issue493.java
#30 = NameAndType #10:#11 // "<init>":()V
#31 = NameAndType #44:#45 // getConnection:()Ljava/sql/Connection;
#32 = Class #46 // java/lang/System
#33 = NameAndType #47:#48 // out:Ljava/io/PrintStream;
#34 = Class #49 // java/io/PrintStream
#35 = NameAndType #50:#11 // println:()V
#36 = NameAndType #51:#11 // close:()V
#37 = Utf8 java/lang/Throwable
#38 = NameAndType #52:#53 // addSuppressed:(Ljava/lang/Throwable;)V
#39 = Utf8 Issue493
#40 = Utf8 java/lang/Object
#41 = Utf8 javax/sql/DataSource
#42 = Utf8 java/sql/Connection
#43 = Utf8 java/sql/SQLException
#44 = Utf8 getConnection
#45 = Utf8 ()Ljava/sql/Connection;
#46 = Utf8 java/lang/System
#47 = Utf8 out
#48 = Utf8 Ljava/io/PrintStream;
#49 = Utf8 java/io/PrintStream
#50 = Utf8 println
#51 = Utf8 close
#52 = Utf8 addSuppressed
#53 = Utf8 (Ljava/lang/Throwable;)V
{
Issue493();
descriptor: ()V
flags: (0x0000)
Code:
stack=1, locals=1, args_size=1
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
LineNumberTable:
line 11: 0
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this LIssue493;
void method(javax.sql.DataSource) throws java.sql.SQLException;
descriptor: (Ljavax/sql/DataSource;)V
flags: (0x0000)
Code:
stack=2, locals=5, args_size=2
0: aload_1
1: invokeinterface #2, 1 // InterfaceMethod javax/sql/DataSource.getConnection:()Ljava/sql/Connection;
6: astore_2
7: getstatic #3 // Field java/lang/System.out:Ljava/io/PrintStream;
10: invokevirtual #4 // Method java/io/PrintStream.println:()V
13: aload_2
14: ifnull 50
17: aload_2
18: invokeinterface #5, 1 // InterfaceMethod java/sql/Connection.close:()V
23: goto 50
26: astore_3
27: aload_2
28: ifnull 48
31: aload_2
32: invokeinterface #5, 1 // InterfaceMethod java/sql/Connection.close:()V
37: goto 48
40: astore 4
42: aload_3
43: aload 4
45: invokevirtual #7 // Method java/lang/Throwable.addSuppressed:(Ljava/lang/Throwable;)V
48: aload_3
49: athrow
50: return
Exception table:
from to target type
7 13 26 Class java/lang/Throwable
31 37 40 Class java/lang/Throwable
LineNumberTable:
line 13: 0
line 14: 7
line 15: 13
line 13: 26
line 16: 50
LocalVariableTable:
Start Length Slot Name Signature
7 43 2 cnn Ljava/sql/Connection;
0 51 0 this LIssue493;
0 51 1 ds Ljavax/sql/DataSource;
StackMapTable: number_of_entries = 4
frame_type = 255 /* full_frame */
offset_delta = 26
locals = [ class Issue493, class javax/sql/DataSource, class java/sql/Connection ]
stack = [ class java/lang/Throwable ]
frame_type = 255 /* full_frame */
offset_delta = 13
locals = [ class Issue493, class javax/sql/DataSource, class java/sql/Connection, class java/lang/Throwable ]
stack = [ class java/lang/Throwable ]
frame_type = 7 /* same */
frame_type = 249 /* chop */
offset_delta = 1
Exceptions:
throws java.sql.SQLException
}
SourceFile: "Issue493.java"
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment