pluggable-types-issta2008-slides

pluggable-types-issta2008-slides - voidprint(@Readonly...

Info iconThis 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; }
Background image of page 1

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

View Full DocumentRight 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)
Background 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 ...
Background image of page 3

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

View Full DocumentRight 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)) ^
Background 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
Background image of page 5

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

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

This note was uploaded on 02/24/2012 for the course CSE 503 taught by Professor Davidnotikin during the Spring '11 term at University of Washington.

Page1 / 37

pluggable-types-issta2008-slides - voidprint(@Readonly...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online