SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
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

Más contenido relacionado

Destacado (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
 

Más de 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
 

Más de 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
 

Último

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Último (20)

Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 

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