basmith / stab-language

Automatically exported from code.google.com/p/stab-language
Apache License 2.0
0 stars 0 forks source link

Trying to access a method of null should not be possible #16

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The following code:

public class Main {

        public static void main( String[] args){
            String s = null.toString();

            System.out.println("DONE");
        }
    }

gives

Exception in thread "main" java.lang.NullPointerException
        at stab.tools.compiler.ExpressionValidator.handleMemberAccess(ExpressionValidator.stab:1286)
        at stab.tools.compiler.ExpressionValidator.handleMemberAccess(ExpressionValidator.stab)
        at stab.tools.syntaxtree.ExpressionHandler.handleExpression(ExpressionHandler.stab:67)
        at stab.tools.compiler.ExpressionValidator.handleInvocation(ExpressionValidator.stab:964)
        at stab.tools.compiler.ExpressionValidator.handleInvocation(ExpressionValidator.stab)
        at stab.tools.syntaxtree.ExpressionHandler.handleExpression(ExpressionHandler.stab:58)
        at stab.tools.compiler.StatementValidator.handleLocalDeclaration(StatementValidator.stab:254)
        at stab.tools.compiler.StatementValidator.handleLocalDeclaration(StatementValidator.stab)
        at stab.tools.syntaxtree.StatementHandler.handleStatement(StatementHandler.stab:67)
        at stab.tools.compiler.StatementValidator.handleBlock(StatementValidator.stab:42)
        at stab.tools.compiler.StatementValidator.handleBlock(StatementValidator.stab)
        at stab.tools.syntaxtree.StatementHandler.handleStatement(StatementHandler.stab:31)
        at stab.tools.compiler.Compiler.validateClassMethodCode(Compiler.stab:2868)
        at stab.tools.compiler.Compiler.validateClassCode(Compiler.stab:2566)
        at stab.tools.compiler.Compiler.validateCode(Compiler.stab:2508)
        at stab.tools.compiler.Compiler.validateCode(Compiler.stab:2525)
        at stab.tools.compiler.Compiler.validateCode(Compiler.stab:2505)
        at stab.tools.compiler.Compiler.validateCode(Compiler.stab:2474)
        at stab.tools.compiler.Compiler.doCompile(Compiler.stab:205)
        at stab.tools.compiler.Compiler.compileFromFiles(Compiler.stab:158)
        at stab.tools.compiler.Application.run(Application.stab:128)
        at stab.tools.compiler.Application.main(Application.stab:30)

Original issue reported on code.google.com by ice.ta...@gmail.com on 3 Jul 2010 at 1:52

GoogleCodeExporter commented 8 years ago
The compiler now reports an error.

Original comment by stab.hac...@gmail.com on 4 Jul 2010 at 11:20