{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

pluggable-types-issta2008-slides

pluggable-types-issta2008-slides - [email protected]

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Practical pluggable types via the Checker Framework Matthew Papi, Mahmood Ali, Telmo Correa Jr., Jeff Perkins, Michael Ernst MIT void print( @Readonly Object x) { List< @NonNull String> lst; }
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Problem 1: Java’s type checking Type checking prevents many bugs int i = “hello”; // type error Type checking doesn’t prevent enough bugs java.lang. NullPointerException at checkers.util.GraphQualifierHierarchy.isSubtype(GraphQualifierHierarchy.java:21 at checkers.types.QualifierHierarchy.isSubtype(QualifierHierarchy.java:70) at checkers.types.TypeHierarchy.isSubtypeImpl(TypeHierarchy.java:100) at checkers.types.TypeHierarchy.isSubtype(TypeHierarchy.java:64) at checkers.basetype.BaseTypeChecker.isSubtype(BaseTypeChecker.java:305) at checkers.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:48 at checkers.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:46 at checkers.basetype.BaseTypeVisitor.checkArguments(BaseTypeVisitor.java:597) at checkers.basetype.BaseTypeVisitor.visitMethodInvocation(BaseTypeVisitor.java:27 at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1315) at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67) at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:110) at com.sun.source.util.TreeScanner.visitExpressionStatement(TreeScanner.java:239) at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1155) at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67) at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:110) at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
Image of page 2
Problem 1: Java’s type checking Type checking prevents many bugs int i = “hello”; // type error Type checking doesn’t prevent enough bugs Null dereferences Incorrect equality tests Incorrect mutation SQL injection Privacy violations Misformatted data ...
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Solution: Pluggable type systems Design a type system to solve a specific problem Write type qualifiers in your code (or, type inference) @NonNull Date d = ...; d.getMonth(); // no possible NPE Type checker warns about violations (bugs) % javac -processor NullnessChecker MyFile.java MyFile.java:149: dereference of possibly-null reference bb2 if (vars1.containsAll(bb2.vars)) ^
Image of page 4
Problem 2: Implementing pluggable types Modify a compiler: hard Previous frameworks: too weak Alternatives to case studies: Soundness proof for core calculus Toy examples Hampers understanding and use of type systems A type system is valuable only if it helps developers to find and prevent errors Case studies are necessary
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Example: Type systems for immutability Formalisms, proofs, etc.
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern