SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
Java problems   Raw type parameters     Working with the Java compiler     Logging         Static analysis




                                          CS/SE Individual Practical


                                                      Stephen Gilmore
                                                     November 11, 2011
                                      School of Informatics, University of Edinburgh




                                                                         CS/SE Individual Practical
                                                                                                      1 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Java problems


                Common Java problems: raw types




                                                                       CS/SE Individual Practical
                                                                                                    2 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Java problems


                Quick fix: a bad suggestion




                                                                       CS/SE Individual Practical
                                                                                                    3 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Java problems


                Check the constructor documentation




                                                                       CS/SE Individual Practical
                                                                                                    4 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Java problems


                Check the class documentation




                                                                       CS/SE Individual Practical
                                                                                                    5 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Java problems


                What type of array are we adapting?




                                                                       CS/SE Individual Practical
                                                                                                    6 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Java problems


                Type parameter added




                                                                       CS/SE Individual Practical
                                                                                                    7 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                Raw type in method header




                                                                       CS/SE Individual Practical
                                                                                                    8 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                Consult the Java documentation




                                                                       CS/SE Individual Practical
                                                                                                    9 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                Adapter doesn’t work here




                                                                       CS/SE Individual Practical
                                                                                                    10 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                Adapter is an interface




                                                                       CS/SE Individual Practical
                                                                                                    11 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                T is not a class




                                                                       CS/SE Individual Practical
                                                                                                    12 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                Object: the goto class




                                                                       CS/SE Individual Practical
                                                                                                    13 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                T extends Adapter doesn’t work




                                                                       CS/SE Individual Practical
                                                                                                    14 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                “?” — the wild card parameter




                                                                       CS/SE Individual Practical
                                                                                                    15 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                “Quick fix” would have worked here




                                                                       CS/SE Individual Practical
                                                                                                    16 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Raw type parameters


                Same result




                                                                       CS/SE Individual Practical
                                                                                                    17 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Working with the Java compiler


                Setting Java compiler preferences




                                                                       CS/SE Individual Practical
                                                                                                    18 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Working with the Java compiler


                Changing defaults




                                                                       CS/SE Individual Practical
                                                                                                    19 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Working with the Java compiler


                Potential programming problems




                                                                       CS/SE Individual Practical
                                                                                                    20 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Working with the Java compiler


                Tighter checking




                                                                       CS/SE Individual Practical
                                                                                                    21 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Working with the Java compiler


                Bug found




                                                                       CS/SE Individual Practical
                                                                                                    22 / 24
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                    Logging


                    Don’t forget to add logging . . .




                                                                           CS/SE Individual Practical
                                                                                                        23 / 24
.41.02.png
Java problems   Raw type parameters   Working with the Java compiler     Logging         Static analysis
                Static analysis


                Deeper analysis (resource leaks . . . )




                                                                       CS/SE Individual Practical
                                                                                                    24 / 24

Weitere ähnliche Inhalte

Andere mochten auch (8)

Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.Compiler vs Interpreter-Compiler design ppt.
Compiler vs Interpreter-Compiler design ppt.
 
Overview of Cloud Storage Enablement and Intelligent Storage Clouds
Overview of Cloud Storage Enablement and Intelligent Storage CloudsOverview of Cloud Storage Enablement and Intelligent Storage Clouds
Overview of Cloud Storage Enablement and Intelligent Storage Clouds
 
cloud computing and android
cloud computing and androidcloud computing and android
cloud computing and android
 
Seminar on cloud computing by Prashant Gupta
Seminar on cloud computing by Prashant GuptaSeminar on cloud computing by Prashant Gupta
Seminar on cloud computing by Prashant Gupta
 
Cloud computing simple ppt
Cloud computing simple pptCloud computing simple ppt
Cloud computing simple ppt
 
Introduction of Cloud computing
Introduction of Cloud computingIntroduction of Cloud computing
Introduction of Cloud computing
 
cloud computing ppt
cloud computing pptcloud computing ppt
cloud computing ppt
 

Mehr von Stephen Gilmore

More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation Examples
Stephen Gilmore
 
Testing Android apps with Robotium
Testing Android apps with RobotiumTesting Android apps with Robotium
Testing Android apps with Robotium
Stephen Gilmore
 
Continuing Android development
Continuing Android developmentContinuing Android development
Continuing Android development
Stephen Gilmore
 
Project management for the individual practical
Project management for the individual practicalProject management for the individual practical
Project management for the individual practical
Stephen Gilmore
 

Mehr von Stephen Gilmore (20)

Feedback on Part 1 of the CSLP
Feedback on Part 1 of the CSLPFeedback on Part 1 of the CSLP
Feedback on Part 1 of the CSLP
 
Feedback on Part 1 of the Software Engineering Large Practical
Feedback on Part 1 of the Software Engineering Large PracticalFeedback on Part 1 of the Software Engineering Large Practical
Feedback on Part 1 of the Software Engineering Large Practical
 
Arrays in Objective-C
Arrays in Objective-CArrays in Objective-C
Arrays in Objective-C
 
More Stochastic Simulation Examples
More Stochastic Simulation ExamplesMore Stochastic Simulation Examples
More Stochastic Simulation Examples
 
Testing Android apps with Robotium
Testing Android apps with RobotiumTesting Android apps with Robotium
Testing Android apps with Robotium
 
Common Java problems when developing with Android
Common Java problems when developing with AndroidCommon Java problems when developing with Android
Common Java problems when developing with Android
 
Quick quiz on Objective-C
Quick quiz on Objective-CQuick quiz on Objective-C
Quick quiz on Objective-C
 
Getting started with Xcode
Getting started with XcodeGetting started with Xcode
Getting started with Xcode
 
Working with databases in Android
Working with databases in AndroidWorking with databases in Android
Working with databases in Android
 
Crash Course in Objective-C
Crash Course in Objective-CCrash Course in Objective-C
Crash Course in Objective-C
 
SELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and ManifestsSELP: Debugging, AVDs and Manifests
SELP: Debugging, AVDs and Manifests
 
The Stochastic Simulation Algorithm
The Stochastic Simulation AlgorithmThe Stochastic Simulation Algorithm
The Stochastic Simulation Algorithm
 
Beginning Android Development
Beginning Android DevelopmentBeginning Android Development
Beginning Android Development
 
Computer Science Large Practical coursework
Computer Science Large Practical courseworkComputer Science Large Practical coursework
Computer Science Large Practical coursework
 
Software Engineering Large Practical coursework
Software Engineering Large Practical courseworkSoftware Engineering Large Practical coursework
Software Engineering Large Practical coursework
 
Introduction to the CSLP and the SELP
Introduction to the CSLP and the SELPIntroduction to the CSLP and the SELP
Introduction to the CSLP and the SELP
 
Feedback on Part 1 of the Individual Practical
Feedback on Part 1 of the Individual PracticalFeedback on Part 1 of the Individual Practical
Feedback on Part 1 of the Individual Practical
 
Creating and working with databases in Android
Creating and working with databases in AndroidCreating and working with databases in Android
Creating and working with databases in Android
 
Continuing Android development
Continuing Android developmentContinuing Android development
Continuing Android development
 
Project management for the individual practical
Project management for the individual practicalProject management for the individual practical
Project management for the individual practical
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Fixing errors in Android Java applications

  • 1. Java problems Raw type parameters Working with the Java compiler Logging Static analysis CS/SE Individual Practical Stephen Gilmore November 11, 2011 School of Informatics, University of Edinburgh CS/SE Individual Practical 1 / 24
  • 2. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Java problems Common Java problems: raw types CS/SE Individual Practical 2 / 24
  • 3. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Java problems Quick fix: a bad suggestion CS/SE Individual Practical 3 / 24
  • 4. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Java problems Check the constructor documentation CS/SE Individual Practical 4 / 24
  • 5. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Java problems Check the class documentation CS/SE Individual Practical 5 / 24
  • 6. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Java problems What type of array are we adapting? CS/SE Individual Practical 6 / 24
  • 7. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Java problems Type parameter added CS/SE Individual Practical 7 / 24
  • 8. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters Raw type in method header CS/SE Individual Practical 8 / 24
  • 9. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters Consult the Java documentation CS/SE Individual Practical 9 / 24
  • 10. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters Adapter doesn’t work here CS/SE Individual Practical 10 / 24
  • 11. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters Adapter is an interface CS/SE Individual Practical 11 / 24
  • 12. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters T is not a class CS/SE Individual Practical 12 / 24
  • 13. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters Object: the goto class CS/SE Individual Practical 13 / 24
  • 14. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters T extends Adapter doesn’t work CS/SE Individual Practical 14 / 24
  • 15. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters “?” — the wild card parameter CS/SE Individual Practical 15 / 24
  • 16. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters “Quick fix” would have worked here CS/SE Individual Practical 16 / 24
  • 17. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Raw type parameters Same result CS/SE Individual Practical 17 / 24
  • 18. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Working with the Java compiler Setting Java compiler preferences CS/SE Individual Practical 18 / 24
  • 19. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Working with the Java compiler Changing defaults CS/SE Individual Practical 19 / 24
  • 20. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Working with the Java compiler Potential programming problems CS/SE Individual Practical 20 / 24
  • 21. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Working with the Java compiler Tighter checking CS/SE Individual Practical 21 / 24
  • 22. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Working with the Java compiler Bug found CS/SE Individual Practical 22 / 24
  • 23. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Logging Don’t forget to add logging . . . CS/SE Individual Practical 23 / 24 .41.02.png
  • 24. Java problems Raw type parameters Working with the Java compiler Logging Static analysis Static analysis Deeper analysis (resource leaks . . . ) CS/SE Individual Practical 24 / 24