Source Code Cross Referenced for StaticInitialisation.java in  » Testing » KeY » de » uka » ilkd » key » rule » metaconstruct » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » KeY » de.uka.ilkd.key.rule.metaconstruct 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // This file is part of KeY - Integrated Deductive Software Design
002:        // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
003:        //                         Universitaet Koblenz-Landau, Germany
004:        //                         Chalmers University of Technology, Sweden
005:        //
006:        // The KeY system is protected by the GNU General Public License. 
007:        // See LICENSE.TXT for details.
008:        //
009:        //
010:        //
011:        //
012:
013:        package de.uka.ilkd.key.rule.metaconstruct;
014:
015:        import de.uka.ilkd.key.java.ArrayOfExpression;
016:        import de.uka.ilkd.key.java.Expression;
017:        import de.uka.ilkd.key.java.ProgramElement;
018:        import de.uka.ilkd.key.java.Services;
019:        import de.uka.ilkd.key.java.abstraction.KeYJavaType;
020:        import de.uka.ilkd.key.java.expression.PassiveExpression;
021:        import de.uka.ilkd.key.java.recoderext.ClassInitializeMethodBuilder;
022:        import de.uka.ilkd.key.java.reference.ExecutionContext;
023:        import de.uka.ilkd.key.java.reference.FieldReference;
024:        import de.uka.ilkd.key.java.reference.MethodReference;
025:        import de.uka.ilkd.key.java.reference.TypeRef;
026:        import de.uka.ilkd.key.logic.ProgramElementName;
027:        import de.uka.ilkd.key.logic.op.ProgramMethod;
028:        import de.uka.ilkd.key.logic.op.ProgramVariable;
029:        import de.uka.ilkd.key.rule.inst.SVInstantiations;
030:        import de.uka.ilkd.key.util.Debug;
031:
032:        public class StaticInitialisation extends ProgramMetaConstruct {
033:
034:            public StaticInitialisation(Expression expr) {
035:                super ("static-initialisation", expr);
036:
037:            }
038:
039:            /** performs the program transformation needed for symbolic
040:             * program transformation 
041:             * @return the transformated program
042:             */
043:            public ProgramElement symbolicExecution(ProgramElement pe,
044:                    Services services, SVInstantiations insts) {
045:                KeYJavaType typeToBeInitialised = null;
046:                if (pe instanceof  FieldReference) {
047:                    final ProgramVariable pv = ((FieldReference) pe)
048:                            .getProgramVariable();
049:                    if (pv.isStatic()) {
050:                        typeToBeInitialised = pv.getContainerType();
051:                    } else {
052:                        return null; // no static initialisation necessary
053:                    }
054:                } else if (pe instanceof  ProgramVariable) {
055:                    final ProgramVariable pv = (ProgramVariable) pe;
056:                    if (pv.isStatic()) {
057:                        typeToBeInitialised = pv.getContainerType();
058:                    } else {
059:                        return null; // no static initialisation necessary
060:                    }
061:                } else if (pe instanceof  MethodReference) {
062:                    final MethodReference mr = (MethodReference) pe;
063:                    final ExecutionContext ec = insts.getContextInstantiation()
064:                            .activeStatementContext();
065:                    final ProgramMethod m;
066:                    final KeYJavaType mrPrefixType = mr
067:                            .determineStaticPrefixType(services, ec);
068:                    if (ec == null) {
069:                        // in this case we are at the top level of a diamond
070:                        // in this case we assume as scope the type of the method prefix
071:                        m = mr.method(services, mrPrefixType, mr
072:                                .getMethodSignature(services, null),
073:                                mrPrefixType);
074:                    } else {
075:                        m = mr.method(services, mr.determineStaticPrefixType(
076:                                services, ec), ec);
077:                    }
078:                    if (m != null) {
079:                        if (m.isStatic()) {
080:                            typeToBeInitialised = m.getContainerType();
081:                        } else {
082:                            return null; // no static initialisation necessary
083:                        }
084:                    }
085:
086:                } else {
087:                    // at the moment the 'new' case is catched via static method 
088:                    // call of <createObject>
089:                    Debug
090:                            .fail("static initialisation: Unexpected case in static initialisation.");
091:                }
092:
093:                if (typeToBeInitialised == null) {
094:                    Debug.fail("static initialisation failed");
095:                    return null;
096:                }
097:
098:                return new PassiveExpression(
099:                        new MethodReference(
100:                                new ArrayOfExpression(),
101:                                new ProgramElementName(
102:                                        ClassInitializeMethodBuilder.CLASS_INITIALIZE_IDENTIFIER),
103:                                new TypeRef(typeToBeInitialised)));
104:            }
105:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.